bmui
Version:
Bluemoon Moon Components
73 lines • 1.59 kB
JavaScript
export default {
data: function data() {
return {
valueInside: '',
disabledInside: false,
checkedInside: false
};
},
props: {
value: {
"default": ''
},
disabled: {
"default": false
},
checked: {
"default": false
},
placeholder: {
"default": ''
},
maxlength: {
"default": undefined
},
type: {
"default": undefined
},
readonly: {
"default": undefined
}
},
computed: {
mixinInputProps: function mixinInputProps() {
return {
// value: this.value,
disabled: this.disabled,
// checked: this.checked,
placeholder: this.placeholder,
maxlength: this.maxlength,
type: this.type,
readonly: this.readonly
};
}
},
watch: {
value: function value(v) {
this.valueInside = this.value;
},
disabled: function disabled(v) {
this.disabledInside = !!this.disabled;
},
checked: function checked(v) {
this.checkedInside = !!this.checked;
},
valueInside: function valueInside(v) {
this.$emit('input', v);
},
checkedInside: function checkedInside(v) {
this.$emit('change', v);
}
},
methods: {
mixinInputDoFocus: function mixinInputDoFocus() {
var target = this.$refs.input;
if (target && typeof target.focus === 'function') target.focus();
}
},
created: function created() {
this.valueInside = this.value;
this.disabledInside = !!this.disabled;
this.checkedInside = !!this.checked;
}
};