[new feature] Number: support v-model (#3531)

This commit is contained in:
neverland
2019-06-17 15:19:21 +08:00
committed by GitHub
parent 6ec870abce
commit ce3dfc859a
6 changed files with 131 additions and 3 deletions

View File

@@ -16,6 +16,10 @@ export default sfc({
})
],
model: {
event: 'update:value'
},
props: {
show: Boolean,
title: String,
@@ -26,6 +30,10 @@ export default sfc({
type: String,
default: 'default'
},
value: {
type: String,
default: ''
},
extraKey: {
type: String,
default: ''
@@ -103,12 +111,16 @@ export default sfc({
return;
}
const { value } = this;
if (type === 'delete') {
this.$emit('delete');
this.$emit('update:value', value.slice(0, value.length - 1));
} else if (type === 'close') {
this.onClose();
} else {
this.$emit('input', text);
this.$emit('update:value', value + text);
}
}
},