weex-native-directive
weex-native-directive copied to clipboard
Use more readable attributes on `<recycle-list>`
Syntax
Change the compiler to support the new syntax.
- Use
for
instead of thelist-data
,alias
andindex
. - Use
switch
instead of thetemplate-key
. - Use
case
instead of thetemplate-type
.
Examples
Before:
<recycle-list :list-data="longList" template-key="cellType" alias="item" index="i">
<cell-slot template-type="A"> ... </cell-slot>
<cell-slot template-type="B"> ... </cell-slot>
</recycle-list>
After:
<recycle-list for="(item, i) in longList" switch="cellType">
<cell-slot case="A"> ... </cell-slot>
<cell-slot case="B"> ... </cell-slot>
</recycle-list>
The data of longList
still should be binding with the <recycle-list>
.
done in https://github.com/vuejs/vue/commit/7cc0b559e9e57fcb3baeae5d8d4c8964aa335b5e