From 3e7f0cac90ae0b075594b18189eb8b790b4d974f Mon Sep 17 00:00:00 2001 From: sudoooooo Date: Wed, 14 Aug 2024 17:28:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=AB=98=E7=BA=A7?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=BF=81=E7=A7=BB=E5=90=8E=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdvancedConfig/OptionConfig.vue | 24 ++++++++++++++----- .../components/AdvancedConfig/RateConfig.vue | 1 - 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/OptionConfig.vue b/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/OptionConfig.vue index a3a6c317..4cbca449 100644 --- a/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/OptionConfig.vue +++ b/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/OptionConfig.vue @@ -91,13 +91,14 @@ export default { }, data() { return { - configVisible: false + configVisible: false, + curOptions: [] } }, computed: { - curOptions() { + options() { const editStore = useEditStore() - return _cloneDeep(editStore.moduleConfig.options) + return editStore.moduleConfig.options }, hashMap() { const mapData = {} @@ -115,17 +116,28 @@ export default { components: { draggable }, + mounted() { + this.initCurOption() + }, watch: { - options(val) { - this.curOptions = _cloneDeep(val) + options: { + handler(val) { + this.curOptions = _cloneDeep(val) + }, + deep: true } }, methods: { + initCurOption() { + const editStore = useEditStore() + this.curOptions = _cloneDeep(editStore.moduleConfig.options) + }, addOtherOption() { this.addOption('其他', true, -1, this.fieldId) }, openOptionConfig() { this.configVisible = true + this.initCurOption() }, addOption(text = '选项', others = false, index = -1, fieldId) { let addOne @@ -164,7 +176,7 @@ export default { return addOne }, - async deleteOption(index) { + deleteOption(index) { this.curOptions.splice(index, 1) }, parseImport(newOptions) { diff --git a/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/RateConfig.vue b/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/RateConfig.vue index b4b845e7..09ac1f2f 100644 --- a/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/RateConfig.vue +++ b/web/src/management/pages/edit/modules/questionModule/components/AdvancedConfig/RateConfig.vue @@ -101,7 +101,6 @@ export default { const res = [] const rangeConfig = editStore.moduleConfig.rangeConfig - console.log(234234, editStore.moduleConfig.rangeConfig) for (let i = this.min; i <= this.max; i++) { res.push({ index: i,