template. Then, define a code snippet in <template/>. For example:<!--index: intmsg: stringtime: string--><template name="msgItem"><view><text> {{index}}: {{msg}} </text><text> Time: {{time}} </text></view></template>
<template is="msgItem" data="{{...item}}"/>
Page({data: {item: {index: 0,msg: 'this is a template',time: '2016-09-15'}}})
is property can use Mustache syntax to dynamically determine the template to be rendered:<template name="odd"><view> odd </view></template><template name="even"><view> even </view></template><block wx:for="{{[1, 2, 3, 4, 5]}}"><template is="{{item % 2 == 0 ? 'even' : 'odd'}}"/></block>
Feedback