补充文档
This commit is contained in:
parent
f6330ce9ea
commit
74f5204bb3
30
README.md
30
README.md
@ -1,3 +1,33 @@
|
|||||||
# widgets
|
# widgets
|
||||||
|
|
||||||
像 flutter 风格用纯粹 js 构建页面
|
像 flutter 风格用纯粹 js 构建页面
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm i @laniakeasupercluster/widgets
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { createElement, Button, Span } from '@laniakeasupercluster/widgets'
|
||||||
|
|
||||||
|
document.body.appendChild(createElement({
|
||||||
|
style: { width: 320, height: 320, padding: 64 },
|
||||||
|
children: [
|
||||||
|
Span({ textContent: 'hello world!' })
|
||||||
|
Button({
|
||||||
|
textContent: 'click',
|
||||||
|
onclick: event => {
|
||||||
|
const randomNumber = Math.floor(Math.random() * 100)
|
||||||
|
event.traget.textContent = 'click' + randomNumber
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### dev
|
||||||
|
```
|
||||||
|
git clone git@git.satori.love:LaniakeaSupercluster/widgets.git
|
||||||
|
npm i
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "widgets",
|
"name": "@laniakeasupercluster/widgets",
|
||||||
"description": "A simple widgets tracker",
|
"description": "A simple widgets tracker",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"author": {
|
"author": "Laniakea Supercluster <huan0016@gmail.com>",
|
||||||
"name": "Laniakea Supercluster",
|
|
||||||
"email": "huan0016@gmail.com"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --open",
|
"dev": "vite --open",
|
||||||
|
Loading…
Reference in New Issue
Block a user