基金列表通过组件循环渲染实现
    所以首先要编写组件的代码
    在components目录下新建item.wpy

    关键代码如下

    1. <template>
    2. <navigator url="detail">
    3. <view class="fund-item">
    4. <view class="fund-item-title">{{listData.name}}</view>
    5. <view class="link-icon light-word">></view>
    6. <view class="fund-item-content">
    7. <view>
    8. <view class="light-word" style="text-align:left;">金额</view>
    9. <view style="text-align:left;">{{listData.balance}}</view>
    10. </view>
    11. <view>
    12. <view class="light-word" style="text-align:center;">昨日收益</view>
    13. <view style="text-align:center;">{{listData.last_day_earn}}</view>
    14. </view>
    15. <view>
    16. <view class="light-word" style="text-align:right;">持有收益</view>
    17. <view style="text-align:right;">{{listData.carry_earn}}</view>
    18. </view>
    19. </view>
    20. </view>
    21. </navigator>
    22. </template>
    23. <script>
    24. import wepy from 'wepy';
    25. export default class Item extends wepy.component {
    26. props = {
    27. listData: {}
    28. };
    29. }
    30. </script>