微信小程序父子组件传递数据
发布时间
阅读量:
阅读量
系统化梳理与回顾
关于子组件 – component属性
在child.json文件中
{
"component": true,
"usingComponents": {}
}
child.wxml
<view class='template-child'>
<block wx:for='{{dataFromParent}}'>
<button data-id='{{item.id}}' bindtap='onTapChild'>{{item.name}}</button>
</blcok>
</view>
child.js
Component({
/** * 组件的属性列表
*/
properties: {
dataFromParent: {
type: Array,
value: [],
observer: function (ne
全部评论 (0)
还没有任何评论哟~
