|
|
@@ -25,7 +25,7 @@
|
|
|
props: {
|
|
|
value: {
|
|
|
type: [String, Number],
|
|
|
- default: '',
|
|
|
+ default: '0',
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
@@ -35,13 +35,11 @@
|
|
|
},
|
|
|
watch: {
|
|
|
value(val) {
|
|
|
- console.log(this.value)
|
|
|
this.num = this.formatPrice(val)
|
|
|
},
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
- console.log(this.value)
|
|
|
this.num = this.formatPrice(this.value)
|
|
|
},
|
|
|
|
|
|
@@ -50,7 +48,6 @@
|
|
|
this.$emit('input', this.num)
|
|
|
},
|
|
|
handleChange(val) {
|
|
|
- console.log('val', val)
|
|
|
this.$nextTick(() => {
|
|
|
this.$emit('change', this.delcommafy(val))
|
|
|
})
|
|
|
@@ -62,19 +59,16 @@
|
|
|
},
|
|
|
// 获得焦点金额去掉格式
|
|
|
uninputMoney(el) {
|
|
|
- console.log('el', el.target.value)
|
|
|
if (el.target.value) {
|
|
|
this.num = this.delcommafy(el.target.value)
|
|
|
} else {
|
|
|
this.num = null
|
|
|
}
|
|
|
- this.$emit('input', this.num)
|
|
|
},
|
|
|
//去除千分位中的‘,’
|
|
|
delcommafy(num) {
|
|
|
if (!num) return num
|
|
|
- num = num.toString()
|
|
|
- num = num.substring(1).replace(/,/gi, '')
|
|
|
+ num = num.toString().replace('¥', '').replace(/,/gi, '')
|
|
|
if (num.indexOf('.00') > 0) num = parseInt(num)
|
|
|
return num
|
|
|
},
|