Commit 8af49c5a authored by Facius's avatar Facius

fix: 完工页面纯数字输入防止粘贴非数字

parent c4508d5a
......@@ -2,28 +2,28 @@
export default {
data() {
return {
dataValue: ''
dataValue: '',
}
},
watch: {
value: function(val) {
this.dataValue = val
}
},
},
props: {
value: {
type: [String, Number],
default: ''
default: '',
},
/** 索引值 用于更新数据 */
itemIndex:Number,
groupIndex:Number,
itemIndex: Number,
groupIndex: Number,
/** 包含数据源 */
item: Object,
disabled: {
type: Boolean,
default: false
}
default: false,
},
},
mounted() {
......@@ -34,13 +34,19 @@ export default {
methods: {
// 输入的值
valueChange(val) {
if (this.type == 'digit') {
// 防止粘贴非数字
val = val.replace(/[^\d.]/gi, '')
this.$nextTick(() => {
this.dataValue = val
})
}
const data = {
groupIndex: this.groupIndex,// 左侧菜单下标
itemIndex:this.itemIndex,//右侧某一项下标
value: val
groupIndex: this.groupIndex, // 左侧菜单下标
itemIndex: this.itemIndex, //右侧某一项下标
value: val,
}
this.$emit('value-change', data)
}
}
},
},
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment