保留2位

retain(key, pow = 2) {
            const [k1, k2] = key.split('.')
            if(!k1 || !k2) return
            if(this[k1][k2]==0) return this.$set(this[k1], k2, '')
            const multiple =  Math.pow(10, Number(pow))
            const num = ~~(Number(this[k1][k2]) * multiple) / multiple
            this.$set(this[k1], k2, num)
        }

0 个评论

要回复文章请先登录注册