wip
This commit is contained in:
parent
6544916b0c
commit
dc7b9d782f
4 changed files with 17 additions and 17 deletions
|
@ -46,7 +46,7 @@ export default defineComponent({
|
||||||
FormButton,
|
FormButton,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
modelValue: {
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
|
@ -104,8 +104,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
emits: ['change', 'keydown', 'enter'],
|
emits: ['change', 'keydown', 'enter'],
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
const { value, type, autofocus } = toRefs(props);
|
const { modelValue, type, autofocus } = toRefs(props);
|
||||||
const v = ref(value.value);
|
const v = ref(modelValue.value);
|
||||||
const id = Math.random().toString(); // TODO: uuid?
|
const id = Math.random().toString(); // TODO: uuid?
|
||||||
const focused = ref(false);
|
const focused = ref(false);
|
||||||
const changed = ref(false);
|
const changed = ref(false);
|
||||||
|
@ -131,13 +131,13 @@ export default defineComponent({
|
||||||
const updated = () => {
|
const updated = () => {
|
||||||
changed.value = false;
|
changed.value = false;
|
||||||
if (type?.value === 'number') {
|
if (type?.value === 'number') {
|
||||||
context.emit('update:value', parseFloat(v.value));
|
context.emit('update:modelValue', parseFloat(v.value));
|
||||||
} else {
|
} else {
|
||||||
context.emit('update:value', v.value);
|
context.emit('update:modelValue', v.value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(value, newValue => {
|
watch(modelValue.value, newValue => {
|
||||||
v.value = newValue;
|
v.value = newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import './debobigego.scss';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
value: {
|
modelValue: {
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
required: {
|
required: {
|
||||||
|
@ -51,10 +51,10 @@ export default defineComponent({
|
||||||
computed: {
|
computed: {
|
||||||
v: {
|
v: {
|
||||||
get() {
|
get() {
|
||||||
return this.value;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
this.$emit('update:value', v);
|
this.$emit('update:modelValue', v);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,7 +29,7 @@ import './debobigego.scss';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
value: {
|
modelValue: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
@ -40,13 +40,13 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
checked(): boolean {
|
checked(): boolean {
|
||||||
return this.value;
|
return this.modelValue;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggle() {
|
toggle() {
|
||||||
if (this.disabled) return;
|
if (this.disabled) return;
|
||||||
this.$emit('update:value', !this.checked);
|
this.$emit('update:modelValue', !this.checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default defineComponent({
|
||||||
FormButton,
|
FormButton,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
modelValue: {
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
required: {
|
required: {
|
||||||
|
@ -74,8 +74,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
const { value } = toRefs(props);
|
const { modelValue } = toRefs(props);
|
||||||
const v = ref(value.value);
|
const v = ref(modelValue.value);
|
||||||
const changed = ref(false);
|
const changed = ref(false);
|
||||||
const inputEl = ref(null);
|
const inputEl = ref(null);
|
||||||
const focus = () => inputEl.value.focus();
|
const focus = () => inputEl.value.focus();
|
||||||
|
@ -86,10 +86,10 @@ export default defineComponent({
|
||||||
|
|
||||||
const updated = () => {
|
const updated = () => {
|
||||||
changed.value = false;
|
changed.value = false;
|
||||||
context.emit('update:value', v.value);
|
context.emit('update:modelValue', v.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(value, newValue => {
|
watch(modelValue.value, newValue => {
|
||||||
v.value = newValue;
|
v.value = newValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue