小程序之WEPY学习笔记
<template>
<child></child>
<anotherchild></anotherchild>
</template>
<script>
components = {
//为两个相同组件的不同实例分配不同的组件ID,从而避免数据同步变化的问题
child: Child,
anotherchild: Child
};
</script>
- wx:for的替代
<repeat for="{{list}}" key="index" index="index" item="item">
<!-- 插入<script>脚本部分所声明的child组件,同时传入item -->
<child :item="item"></child>
</repeat>