1. Wechat mini program event

Wechat applet events are bound by bind or catch. Bind events will bubble to the parent element and can be caught by the parent element, and catch will prevent events from bubbling to the parent element. Wechat applet events can not be like native JavaScript and the three major frameworks, after the event followed by small brackets, inside the dynamic parameters. It only passes an Event object by default.

2, micro channel applets dynamic transmission to participate in the acquisition of parameters

After you bind or catch an event, you can use the data-dynamic parameter name =” value to be transmitted “on the element to which the event is bound, and use the e.target.dataset in the corresponding event. Dynamic parameter name or E. currenttarget. dataset. The dynamic parameter name gets the value of the dynamic parameter.

<! --> <view wx:for="{{isChecked}}" wx:key="index"> <! <view class= > <view class= > <view class= > <view class= > <view class= > <view class= > <view class= > <view class="vf {{item==true? '':'vf-active'}}" bindtap="click" data-id="{{index}}">{{index+1}}</view>
</view>

click: function (e) {
    console.log(e.target.dataset.id);
    var id = e.target.dataset.id
    var str = "isChecked[" + id + "]"// This. SetData ({[STR]:false// Enclose STR in brackets})}Copy the code