How does WeChat Mini Programs click to get the content in the loop?

Click to get the corresponding array contents

Array structure:

{
    date: "2018-03-13",
    z_num: "450",
    m_num: "6",
    money: "3956.67",
    id: 13,
    line: [{
        placeholder: "",
        item_unm: "2000.60",
        num: 1
    }, {
        placeholder: "",
        item_unm: "400.00",
        num: 1
    }, {
        placeholder: "",
        item_unm: "1565.07",
        num: 1
    }]
},

js:

bindDate:function(e){
    var that = this;
    var datas = that.data.datas;
    var id = e.currentTarget.dataset.id;
    for (let i in datas){
      var datdId = datas[i][id].line;
      that.setData({
        line: datdId
      })
    }
    console.log(id);
    that.getTotalPrice();
},

you can pass the data through the click event through the data- attribute.
also finds the corresponding data by passing an index,!

http://callmesoul.cn/


wx:for
< view data-index=' {{index}} 'data-value=' {{item.placeholder}} >

< / view >
index index can pass values of types such as Array or Object


https://github.com/Liuniuliu/.

has been put into github

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea34f1-1c4b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea34f1-1c4b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?