微信小程序picker-view设置默认显示某个值

<picker-view bindchange="bindintWeightChange"

indicator-style="height: 50px;"

style="width: 100%; height: 120px;"

value="{{value}}"

class="margin">

<picker-view-column>

<view wx:for="{{weightArray}}"

wx:key="{{index}}"

style="line-height: 50px">{{weightArray[index]}</view>

</picker-view-column>

</picker-view>

默认值设置下标为1

this.setData({
      value:[1]
    })

如果picker-view中有多组picker-view-column则

this.setData({
      value:[1,2,3]
    })

猜你喜欢

转载自blog.csdn.net/lygzscnt12/article/details/82596713