Open yyx990803 opened 6 years ago
That's great. The switch
and case
should be optional.
Furthermore, we should clarify some edge cases.
switch
Only use the first <cell-slot>
to render all data in longList
. The case
property is no longer useful. Even if there are more than one <cell-slot>
, the rest will be ignored.
default
attributeIf switch
exists and some <cell-slot>
contains the default
attribute, it should be rendered only if the type of item data doesn't match any case
.
<recycle-list for="item in longList" switch="type">
<cell-slot case="label">
<text>{{ item.foo }}</text>
</cell-slot>
<cell-slot default>
<text>{{ item.bar }}</text>
</cell-slot>
</recycle-list>
Only the first default
is valid, the rest will be ignored.
switch
exists, but some <cell-slot>
has no case
or default
Those <cell-slot>
s should be ignored.
I think we should also throw warnings for case 1 and 3.
Currently it seems
switch
andcase
attributes (previouslytemplate-key
andtemplate-type
) are always required, even when there is only one<cell-slot>
.I think when there is only one
<cell-slot>
, it should be used by default, soswitch
andcase
can be omitted: