var hanbi = huilv * aa
var text8_sum = hanbi.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, '$1,')
程序是像上面这样写的。
但是会提示
hanbi.replace is not a function;
完整代码如下 请各位多多指点
wx.request({
url: 'http://jx'x'x'x'x/cai2/index.php/Caigoudan/huilv',
success: function (e) {
if (e.data != 0) {
var huilv = e.data[0].hulv
// var heji = _this.data.heji
console.log(huilv + '--hulv')
console.log(aa + '--heji')
var hanbi = huilv * aa
var text8_sum = hanbi.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, '$1,')
wx.setStorageSync('jine', hanbi)
_this.setData({
huilv: huilv,
hanbi: hanbi,
heji:aa
})
_this.get_add()
} else {
}
}
})
var hanbi = huilv * aa
hanbi += ‘’
var text8_sum = hanbi.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, '$1,')
看上去 hanbi(憨逼?) 是个数字呀,怎么用 replace 方法呢