
1.mywxs.wxs
module.exports = {
text: 'This is from wxs',
filter: function (value) {
if (value === '01') {
return '未验真'
} else if (value === '11') {
return '验真'
} else if (value === '12') {
return '存疑'
} else {
return '暂无数据'
}
}
};
2.cover.wpy 使用
<template>
<view class='coversee'>
<text style='color:red' wx:if='{{tempFilePaths[pageId].CHECK_STATUS}}'> {{m1.filter(tempFilePaths[pageId].CHECK_STATUS)}} </text>
</view>
</template>
<script>
import wepy from 'wepy'
import fetch from '../utils/fetch.js'
import Notify from '../components/vant/notify/notify'
import mywxs from '../wxs/mywxs.wxs'
export default class Coversee extends wepy.page {
wxs = {
m1: mywxs
}
}
</script>
本文介绍了一个使用WXS模块进行数据过滤的例子,并展示了如何在wepy框架中引入和使用该模块。通过wxs模块,实现了对数据状态的有效转换,如'未验真'、'验真'、'存疑'等。同时,文章提供了具体的wepy组件代码,展示了如何将WXS模块的过滤功能应用到页面展示中。
1680

被折叠的 条评论
为什么被折叠?



