wxs 中 toLocaleString 无效

发布于 6 年前作者 yangzhang1051 次浏览最后编辑 6 年前来自 ask
module.exports = {
  currency: function (money) {
    var money = money.toLocaleString('zh-CN', {
      style: 'currency',
      currency: 'CNY'
    });
    return money;
  }
}

在 wxs 中 使用 toLocaleString 并没有按照预期进行格式化,而我看文档中 wxs 是支持 toLocaleString 方法的

2 回复
xia65
xia651 楼6 年前

toLocaleString方法是支持的,只是不支持代码中对应的locales/options参数。

yang69
yang692 楼4 年前

同问