写函数传入数字
numfix(num) {
return num / 10000 >= 1
? (num / 10000).toFixed(2) + "w"
: num / 1000 >= 1
? (num / 1000).toFixed(2) + "k"
: num;
}
使用的时候
this.numfix(9999)
建议放入公共js文件,需要的时候再去引入
写函数传入数字
numfix(num) {
return num / 10000 >= 1
? (num / 10000).toFixed(2) + "w"
: num / 1000 >= 1
? (num / 1000).toFixed(2) + "k"
: num;
}
使用的时候
this.numfix(9999)
建议放入公共js文件,需要的时候再去引入