fix: 修复高级设置迁移后无法交互问题

This commit is contained in:
sudoooooo 2024-08-14 17:28:59 +08:00
parent f3b8ab278a
commit 3e7f0cac90
2 changed files with 18 additions and 7 deletions

View File

@ -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) {
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) {

View File

@ -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,