@ubuilder/components
Version:
UBuilder Components
46 lines (45 loc) • 888 B
JavaScript
export default {
model: {
props: 'modelValue',
event: 'update:modelValue',
},
props: {
modelValue: [String, Number, Boolean, Function, Object, Array],
nativeValue: [String, Number, Boolean, Function, Object, Array],
type: String,
disabled: Boolean,
required: Boolean,
name: String,
size: String,
},
data() {
return {
newValue: this.modelValue,
};
},
computed: {
computedValue: {
get() {
return this.newValue;
},
set(value) {
this.newValue = value;
this.$emit('update:modelValue', value);
},
},
},
watch: {
/**
* When v-model change, set internal value.
*/
value(value) {
this.newValue = value;
},
},
methods: {
focus() {
// MacOS FireFox and Safari do not focus when clicked
this.$refs.input.focus();
},
},
};