-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(weex): generate "@render" function for weex recycle-list (vuejs#…
…6987) * feat($compiler): support to generate @render function for weex recycle-list Compile the template twice with different options for weex platform if the “recyclable” flag is passed. Generate both normal render function and “@render” function for recycle-list. Adjust function names and arguments in recycle-list compiler. * test(weex): add test cases for <recycle-list>
- Loading branch information
1 parent
49acb10
commit b2fff8a
Showing
28 changed files
with
588 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 20 additions & 16 deletions
36
src/platforms/weex/compiler/modules/recycle-list/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
({ | ||
type: 'recycle-list', | ||
attr: { | ||
listData: [ | ||
{ type: 'A', count: 1, source: 'http://whatever.com/x.png' }, | ||
{ type: 'A', count: 2, source: 'http://whatever.com/y.png' }, | ||
{ type: 'A', count: 3, source: 'http://whatever.com/z.png' } | ||
], | ||
templateKey: 'type', | ||
alias: 'item' | ||
}, | ||
children: [{ | ||
type: 'cell-slot', | ||
attr: { templateType: 'A' }, | ||
children: [{ | ||
type: 'image', | ||
attr: { | ||
resize: 'cover', | ||
src: { | ||
'@binding': 'item.source' | ||
} | ||
} | ||
}, { | ||
type: 'text', | ||
attr: { | ||
lines: '3', | ||
count: { | ||
'@binding': 'item.count' | ||
} | ||
} | ||
}] | ||
}] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<recycle-list :list-data="longList" template-key="type" alias="item"> | ||
<cell-slot template-type="A"> | ||
<image resize="cover" :src="item.source"> | ||
<text lines="3" v-bind:count="item.count"></text> | ||
</cell-slot> | ||
</recycle-list> | ||
</template> | ||
|
||
<script> | ||
module.exports = { | ||
data () { | ||
return { | ||
longList: [ | ||
{ type: 'A', count: 1, source: 'http://whatever.com/x.png' }, | ||
{ type: 'A', count: 2, source: 'http://whatever.com/y.png' }, | ||
{ type: 'A', count: 3, source: 'http://whatever.com/z.png' } | ||
] | ||
} | ||
} | ||
} | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
({ | ||
type: 'recycle-list', | ||
attr: { | ||
listData: [ | ||
{ type: 'A', dynamic: 'decimal', two: '2', four: '4' }, | ||
{ type: 'A', dynamic: 'binary', two: '10', four: '100' } | ||
], | ||
templateKey: 'type', | ||
alias: 'item' | ||
}, | ||
children: [{ | ||
type: 'cell-slot', | ||
attr: { templateType: 'A' }, | ||
children: [{ | ||
type: 'text', | ||
attr: { | ||
value: 'static' | ||
} | ||
}, { | ||
type: 'text', | ||
attr: { | ||
value: { '@binding': 'item.dynamic' } | ||
} | ||
}, { | ||
type: 'text', | ||
attr: { | ||
value: [ | ||
'one ', | ||
{ '@binding': 'item.two' }, | ||
' three ', | ||
{ '@binding': 'item.four' }, | ||
' five' | ||
] | ||
} | ||
}] | ||
}] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<recycle-list :list-data="longList" template-key="type" alias="item"> | ||
<cell-slot template-type="A"> | ||
<text>static</text> | ||
<text>{{item.dynamic}}</text> | ||
<text>one {{item.two}} three {{ item.four }} five</text> | ||
</cell-slot> | ||
</recycle-list> | ||
</template> | ||
|
||
<script> | ||
module.exports = { | ||
data () { | ||
return { | ||
longList: [ | ||
{ type: 'A', dynamic: 'decimal', two: '2', four: '4' }, | ||
{ type: 'A', dynamic: 'binary', two: '10', four: '100' } | ||
] | ||
} | ||
} | ||
} | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
({ | ||
type: 'recycle-list', | ||
attr: { | ||
listData: [ | ||
{ type: 'A' }, | ||
{ type: 'A' } | ||
], | ||
templateKey: 'type', | ||
alias: 'item' | ||
}, | ||
children: [{ | ||
type: 'cell-slot', | ||
attr: { templateType: 'A' }, | ||
children: [{ | ||
type: 'image', | ||
attr: { | ||
'[[match]]': 'item.sourceA', | ||
src: { '@binding': 'item.sourceA' } | ||
} | ||
}, { | ||
type: 'image', | ||
attr: { | ||
'[[match]]': '!(item.sourceA) && (item.sourceB)', | ||
src: { '@binding': 'item.sourceB' } | ||
} | ||
}, { | ||
type: 'image', | ||
attr: { | ||
'[[match]]': '!(!(item.sourceA) && (item.sourceB))', | ||
src: { '@binding': 'item.placeholder' } | ||
} | ||
}] | ||
}] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<recycle-list :list-data="longList" template-key="type" alias="item"> | ||
<cell-slot template-type="A"> | ||
<image v-if="item.sourceA" :src="item.sourceA"></image> | ||
<image v-else-if="item.sourceB" :src="item.sourceB"></image> | ||
<image v-else :src="item.placeholder"></image> | ||
</cell-slot> | ||
</recycle-list> | ||
</template> | ||
|
||
<script> | ||
module.exports = { | ||
data () { | ||
return { | ||
longList: [ | ||
{ type: 'A' }, | ||
{ type: 'A' } | ||
] | ||
} | ||
} | ||
} | ||
</script> | ||
|
Oops, something went wrong.