微信小程序 WXS 的简单使用

如果有个时间 2020-09-25 17:20:00 , 但我们只想要年月日,这样就可以在WXS中实现过滤

data: {
    time : "2020-09-25 17:20:00"//比如这个是后台返回的一个时间
  },

 

WXML 中

<wxs module="fn">
      module.exports={
          split:function(str){
             var res = str.split(' ')[0]
             return res;
          }
      }
  </wxs>
  <view class="time">时间年月日: {{fn.split(
time
)}}</view>

 

posted @ 2020-09-25 10:40  路西德  阅读(477)  评论(0)    收藏  举报