34 lines
709 B
Markdown
34 lines
709 B
Markdown
# widgets
|
|
|
|
像 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
|
|
```
|