From afc995b4bd3cbbf0c875c8791b2993e89c95017a Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Thu, 25 Jan 2024 10:29:19 +0100 Subject: [PATCH] Form Input modelValue dummy --- public/js/components/Form/Input.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/public/js/components/Form/Input.js b/public/js/components/Form/Input.js index 1fc318523..4fc565dbb 100644 --- a/public/js/components/Form/Input.js +++ b/public/js/components/Form/Input.js @@ -22,7 +22,8 @@ export default { data() { return { valid: undefined, - feedback: [] + feedback: [], + modelValueDummy: undefined } }, computed: { @@ -31,8 +32,9 @@ export default { return true; if (this.containerClass) return true; - if (this.autoContainerClass) - return true; + for (const prop in this.autoContainerClass) + if (Object.hasOwn(this.autoContainerClass, prop)) + return true; return false; }, acc() { @@ -70,6 +72,8 @@ export default { }, tag() { switch (this.lcType) { + case 'textarea+': + return 'textarea'; case 'textarea': case 'select': return this.lcType; @@ -122,6 +126,7 @@ export default { case 'number': case 'password': case 'textarea': + case 'textarea+': if (!c.includes('form-control')) classes.push('form-control'); break; @@ -145,9 +150,13 @@ export default { }, modelValueCmp: { get() { + if (this.$attrs.modelValue === undefined) + return this.modelValueDummy; return this.$attrs.modelValue; }, set(v) { + if (this.$attrs.modelValue === undefined) + this.modelValueDummy = v; this.$emit('update:modelValue', v); } }, @@ -204,13 +213,14 @@ export default { template: ` - - - + + +
{{ modelValueCmp?.length || 0 }} / {{ $attrs.maxlength }}