support InputNumber
support InputNumber
This commit is contained in:
parent
456daf3492
commit
c97c42ab2e
8 changed files with 50 additions and 14 deletions
|
@ -92,7 +92,8 @@
|
|||
return {
|
||||
focused: false,
|
||||
upDisabled: false,
|
||||
downDisabled: false
|
||||
downDisabled: false,
|
||||
currentValue: this.value
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -164,7 +165,7 @@
|
|||
}
|
||||
|
||||
const targetVal = Number(e.target.value);
|
||||
let val = Number(this.value);
|
||||
let val = Number(this.currentValue);
|
||||
const step = Number(this.step);
|
||||
if (isNaN(val)) {
|
||||
return false;
|
||||
|
@ -196,9 +197,11 @@
|
|||
},
|
||||
setValue (val) {
|
||||
this.$nextTick(() => {
|
||||
this.value = val;
|
||||
this.currentValue = val;
|
||||
this.$emit('input', val);
|
||||
this.$emit('on-change', val);
|
||||
this.$dispatch('on-form-change', val);
|
||||
// todo 事件
|
||||
// this.$dispatch('on-form-change', val);
|
||||
});
|
||||
},
|
||||
focus () {
|
||||
|
@ -224,7 +227,7 @@
|
|||
|
||||
if (isValueNumber(val)) {
|
||||
val = Number(val);
|
||||
this.value = val;
|
||||
this.currentValue = val;
|
||||
|
||||
if (val > max) {
|
||||
this.setValue(max);
|
||||
|
@ -234,7 +237,7 @@
|
|||
this.setValue(val);
|
||||
}
|
||||
} else {
|
||||
event.target.value = this.value;
|
||||
event.target.value = this.currentValue;
|
||||
}
|
||||
},
|
||||
changeVal (val) {
|
||||
|
@ -250,11 +253,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
compiled () {
|
||||
this.changeVal(this.value);
|
||||
mounted () {
|
||||
this.changeVal(this.currentValue);
|
||||
},
|
||||
watch: {
|
||||
value (val) {
|
||||
this.currentValue = val;
|
||||
},
|
||||
currentValue (val) {
|
||||
this.changeVal(val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import Checkbox from './components/checkbox';
|
|||
// import Form from './components/form';
|
||||
import Icon from './components/icon';
|
||||
import Input from './components/input';
|
||||
// import InputNumber from './components/input-number';
|
||||
import InputNumber from './components/input-number';
|
||||
// import LoadingBar from './components/loading-bar';
|
||||
// import Menu from './components/menu';
|
||||
// import Message from './components/message';
|
||||
|
@ -74,7 +74,7 @@ const iview = {
|
|||
Icon,
|
||||
// iInput: Input,
|
||||
Input,
|
||||
// InputNumber,
|
||||
InputNumber,
|
||||
// LoadingBar,
|
||||
// Menu,
|
||||
// MenuGroup: Menu.Group,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue