javascript - The content cannot be obtained when calling other arrays in the for loop of the applet
为情所困
为情所困 2017-06-15 09:23:14
0
2
667

Achieve the effect: first enter the page to determine whether the color is out of stock!

code show as below:

<block wx:for="{{colorInfo}}" wx:key="key">
        <text class="{{colorSelect[index]}}">{{item.colorComment}}</text>
      </block>

The colorInfo and colorSelect arrays both have values

为情所困
为情所困

reply all(2)
漂亮男人

Expand colorInfo and take a look

洪涛
<block wx:for="{{colorInfo}}" >
    <text class="{{colorSelect[index]}}">{{item.colorComment}}</text>
</block>

or specify


<block wx:for="{{colorInfo}}" wx:for-index="index">
    <text class="{{colorSelect[index]}}">{{item.colorComment}}</text>
</block>

I tried it, this method is possible
Definition in js:

Page display

The structure displayed on the final interface:

Page display

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template