update readme

This commit is contained in:
张磊 2018-10-26 16:00:52 +08:00
parent c7c7ccb907
commit 0a64b9621d
3 changed files with 50 additions and 1 deletions

View File

@ -11,6 +11,7 @@
- [Ref](#ref)
- [Store](#store)
- [Slot](#slot)
- [Pure Element](#pure-element)
- [SSR](#ssr)
### My First Element
@ -309,6 +310,30 @@ render(<my-app></my-app>, 'body')
[→ Slot MDN](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots#Adding_flexibility_with_slots)
### Pure Element
```js
tag('my-ele', function (props) {
return (
<ul>
{props.items.map(item => (
<li key={item.id}>{item.text}</li>
))}
</ul>
)
})
```
使用该自定义元素:
```js
<my-ele
items={[{ text: 'Omi', id: 1 }, { text: "Tencent", id: 2 }]}
/>
```
注意Pure Element 不兼容 IE11 。
### SSR
推荐尝试的框架:

View File

@ -11,6 +11,7 @@ English | [简体中文](./main-concepts.cn.md)
- [Ref](#ref)
- [Store](#store)
- [Slot](#slot)
- [Pure Element](#pure-element)
- [SSR](#ssr)
### My First Element
@ -320,6 +321,30 @@ render(<my-app></my-app>, 'body')
[→ Slot MDN](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots#Adding_flexibility_with_slots)
### Pure Element
```js
tag('my-ele', function (props) {
return (
<ul>
{props.items.map(item => (
<li key={item.id}>{item.text}</li>
))}
</ul>
)
})
```
Use it:
```js
<my-ele
items={[{ text: 'Omi', id: 1 }, { text: "Tencent", id: 2 }]}
/>
```
Do not use pure element in browsers that do not support Reflect, such as ie11.
### SSR
Recommended class libraries:

View File

@ -1 +0,0 @@
# Omi 4.0.0