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() { data() {
return { return {
configVisible: false configVisible: false,
curOptions: []
} }
}, },
computed: { computed: {
curOptions() { options() {
const editStore = useEditStore() const editStore = useEditStore()
return _cloneDeep(editStore.moduleConfig.options) return editStore.moduleConfig.options
}, },
hashMap() { hashMap() {
const mapData = {} const mapData = {}
@ -115,17 +116,28 @@ export default {
components: { components: {
draggable draggable
}, },
mounted() {
this.initCurOption()
},
watch: { watch: {
options(val) { options: {
this.curOptions = _cloneDeep(val) handler(val) {
this.curOptions = _cloneDeep(val)
},
deep: true
} }
}, },
methods: { methods: {
initCurOption() {
const editStore = useEditStore()
this.curOptions = _cloneDeep(editStore.moduleConfig.options)
},
addOtherOption() { addOtherOption() {
this.addOption('其他', true, -1, this.fieldId) this.addOption('其他', true, -1, this.fieldId)
}, },
openOptionConfig() { openOptionConfig() {
this.configVisible = true this.configVisible = true
this.initCurOption()
}, },
addOption(text = '选项', others = false, index = -1, fieldId) { addOption(text = '选项', others = false, index = -1, fieldId) {
let addOne let addOne
@ -164,7 +176,7 @@ export default {
return addOne return addOne
}, },
async deleteOption(index) { deleteOption(index) {
this.curOptions.splice(index, 1) this.curOptions.splice(index, 1)
}, },
parseImport(newOptions) { parseImport(newOptions) {

View File

@ -101,7 +101,6 @@ export default {
const res = [] const res = []
const rangeConfig = editStore.moduleConfig.rangeConfig const rangeConfig = editStore.moduleConfig.rangeConfig
console.log(234234, editStore.moduleConfig.rangeConfig)
for (let i = this.min; i <= this.max; i++) { for (let i = this.min; i <= this.max; i++) {
res.push({ res.push({
index: i, index: i,