Add template
parent
2ab45fea85
commit
dd98ae85b3
|
@ -0,0 +1,40 @@
|
|||
# 模板
|
||||
> 模板语法基于原生的字符串模板, 并实现了一套指令, 提供类似`vue`的API.
|
||||
|
||||
|
||||
|
||||
## 基础用法示例
|
||||
|
||||
```js
|
||||
|
||||
import { html, Component } from 'wkit'
|
||||
|
||||
class Foo extends Component {
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<h1>Hello Wkit!</h1>
|
||||
`
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### 渲染变量
|
||||
|
||||
```js
|
||||
class Foo extends Component {
|
||||
static props = {
|
||||
name: 'Wkit'
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<h1>Hello ${this.name}!</h1>
|
||||
`
|
||||
}
|
||||
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue