Advertisement

微信小程序父子组件传递数据

阅读量:

系统化梳理与回顾

关于子组件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)

还没有任何评论哟~