欢迎光临
感谢一路有你

小程序 | wxs在wxml中使用

如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
 
<view class='posting-container' wx:if="{{posting}}">
  <view class='post-header'>
    <text>点击图标+1</text>
    <text bind:tap="onCancel" class='cancel'>取消</text>
  </view>
  <view class='comment-container'>
    <block wx:for="{{util.limit(comments,3)}}">
      <v-tag text = "{{item.content}}" tag-class="{{tool.highlight(index)}}" >
      <text class='num' slot="after">{{'+'+item.nums}}</text>
      </v-tag>
    </block>
  </view>
  <input class='post' placeholder='短评最多12个字'
  ></input>

</view>
<!-- 在wxml中写wxs -->
<wxs module="tool">
  var highlight = function(index){
    if(index==0){
      return 'ex-tag1'
    }
    if(index==1){
      return 'ex-tag2'
    }
    return ''
  }
  module.exports={
    highlight:highlight
  }
</wxs>

 

赞(2) 打赏
未经允许不得转载:王明昌博客 » 小程序 | wxs在wxml中使用
分享到: 更多 (0)

相关推荐

  • 暂无文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

×
订阅图标按钮