小程序在自定义组件模版里面能像Vue用methods函数吗
发布于 5 年前 作者 hshen 4290 次浏览 来自 问答

小程序在自定义组件模版里面能像Vue用methods函数吗

index.js

methods: {
reduce(arr){
return ~arr.indexOf(this.type)
}
}

index.wxml

<view class="font14 col_555 line {{reduce([1]) ? 'line1' : 'line2'}} marTop">
{{_item.content}}
</view>
回到顶部