From 3959e507bfa99cc4ced2a6f48f9b4358334d34c4 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 19 十二月 2023 17:34:45 +0800 Subject: [PATCH] 1. 调试表单选项组件的双向绑定逻辑 --- src/components/search-option/base/FYOptionText.vue | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/components/search-option/base/FYOptionText.vue b/src/components/search-option/base/FYOptionText.vue index 47bc779..980feb5 100644 --- a/src/components/search-option/base/FYOptionText.vue +++ b/src/components/search-option/base/FYOptionText.vue @@ -1,6 +1,12 @@ <template> - <el-form-item :label="label"> - <el-input clearable v-model="searchText" :placeholder="placeholder" /> + <el-form-item :label="label" :prop="prop"> + <el-input + clearable + :model-value="value" + :placeholder="placeholder" + @input="handleInput" + style="width: 150px" + /> </el-form-item> </template> @@ -9,32 +15,24 @@ props: { label: { type: String, - default: '鏌ヨ椤�', + default: '鏌ヨ椤�' }, placeholder: { type: String, - default: '杈撳叆鎼滅储鍐呭', + default: '杈撳叆鎼滅储鍐呭' }, // 杩斿洖缁撴灉 value: String, + prop: String }, emits: ['update:value'], data() { - return { - searchText: '', - }; + return {}; }, - watch: { - searchText(nVal, oVal) { - if (nVal != oVal) { - this.$emit('update:value', nVal); - } - }, - value(nVal, oVal) { - if (nVal != oVal) { - this.searchText = nVal; - } - }, - }, + methods: { + handleInput(value) { + this.$emit('update:value', value); + } + } }; </script> -- Gitblit v1.9.3