The method in the wepy framework computed, how to pass parameters in the template

there is such a demand at present:

<view wx:for="{{getUserInfo}}" wx:key="index" wx:for-index="index">
    <!-- -->
    <view>{{item.name}}</view>
    <!-- -->
    <view>{{setUserName}}</view> 
</view>
computed = {
    setUserName(name) {
       name = item.name;
       ... 
       return name;
    }
};

want to know what to do with this? Has anyone met it? How do you handle it?


gives you an idea. The two view can be placed in wx:if and wx:else respectively, so that the view in else is displayed when the data method in the calculation property changes.

Menu