gitByLegend

在wxml页面执行toFixed函数的时候发现失效,在微信小程序的js页面是生效的,但是我不希望在data中保留这些额外的数据,于是找到了下面这种解决方案wxs脚本语言

<wxs module="m1">
  var numberToFix= function (value) {
    return value.toFixed(2)
  }
 module.exports.numberToFix=numberToFix;
</wxs>
<view>toFixed:{{m1.numberToFix(value*3)}}</view>

  

data: {
    value:1.567
 },

  

分类:

技术点:

相关文章:

  • 2021-11-18
  • 2021-11-18
  • 2021-08-29
  • 2022-12-23
  • 2021-11-15
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2021-11-18
  • 2021-11-18
  • 2022-02-09
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案