q15926131618 2021-09-16 12:04 采纳率: 100%
浏览 51
已结题

微信小程序chechbox标签中,运行wx:for循环有问题,求解决!

微信小程序chechbox标签中,运行wx:for循环有问题,无法显示value与name。

img

<view>
     <checkbox-group bind:change="fruit">
         <checkbox value="{{item.value}}" wx:for="list" wx:key="id">
         {{item.name}}
         </checkbox>
     </checkbox-group>
     <view>您喜欢的水果是:{{mo}}</view>
</view>

以下是js代码

page({
date:{
    list:[
      {
       id:0,
       name:"苹果",
       value:"苹果"
      },
      {
       id: 1,
       name:"香蕉",
       value:"香蕉"
      },
      {
      id:2,
      name:"桔子",
      value:"桔子"
     }
  ],
  mo:[]
  },
  fruit(e){
  const mo=e.detail.value;
  this.setData({
      mo
  })
  }
}
  • 写回答

4条回答 默认 最新

查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 9月24日
  • 已采纳回答 9月16日
  • 创建了问题 9月16日