Article From:https://segmentfault.com/q/1010000011697814
Question:
<view data-one='item' class="{{index % 2 === 0 ? 'log-list mar':'log-list'}}" wx:for="{{list}}" wx:key="index" wx:for-item="item">
      <view class='img-box'></view>
      <view class="log-item">Shop: {{item.title}}< /view>< view class= "log-item" > about class= function; m< /view></view>

In the JS file, write a method based on the distance data returned by item.id! How do I write this?

Answer 0:

You can do simple calculations, three operations or string operations only in small program template renderings. If the event you write is too complex to support, you can calculate it in js, assign it to JSON data, and render it directly in the template

Leave a Reply

Your email address will not be published. Required fields are marked *