小程序 数组循环赋值this.setData ,数组赋值

给durgsList数组赋值

drugsList:[

      {

        name:'',

        number:'',

        spec:'',

        unit:'',

        manufactor:'',

        specialRadio:'1', //是否特殊药品

      }

    ],

specialRadioChange(el){

    this.data.drugsList.forEach((item,index)=>{

      this.setData({

        ["drugsList["+index+"].specialRadio"]: el.detail,

      });

    })

    console.log(this.data);   

  },

xml:

    

      *\t是否喜欢

      

        

        

    

    

你可能感兴趣的:(小程序,js)