diff --git a/src/components/ShikigamiProperty.vue b/src/components/ShikigamiProperty.vue index 3fedb20..84369f2 100644 --- a/src/components/ShikigamiProperty.vue +++ b/src/components/ShikigamiProperty.vue @@ -168,15 +168,11 @@ export default { }, watch: { showProperty(newVal, oldVal) { - console.log("==aaaaaaa=====>>>> ", newVal, oldVal); + // this.shikigami = this.currentShikigami; + console.log("currentShikigami", JSON.stringify(this.currentShikigami)); this.show = newVal; }, currentShikigami(newVal, oldVal) { - console.log("confirm====" + JSON.stringify(newVal)) - - console.log("confirm====" + JSON.stringify(oldVal)) - - console.log("===item====>>>> ", newVal, oldVal); if (newVal.properties != undefined && newVal.properties.edit == true) { this.shikigami = newVal.properties; } @@ -184,8 +180,6 @@ export default { }, 'shikigami.yuhun.target': { handler(newVal, oldVal) { - console.log(newVal) - console.log(JSON.stringify(this.shikigami.yuhun)) switch (newVal) { // case "1": { @@ -283,48 +277,35 @@ export default { }, methods: { editShikigami() { - console.log("==== 选择御魂 ==="); // this.currentShikigami = item; this.showYuhunSelect = true; // this.index = index; }, closeYuhunSelect() { - console.log("==== 关闭御魂选择 ==="); // this.currentShikigami = item; this.showYuhunSelect = false; // this.index = index; }, updateYuhunSelect(yuhun) { this.showYuhunSelect = false; - console.log("==== 完成御魂选择 ==="); - console.log(yuhun); - console.log(this.shikigami.yuhun.yuhunSetEffect); let length = this.shikigami.yuhun.yuhunSetEffect.length; this.shikigami.yuhun.yuhunSetEffect.push(JSON.parse(JSON.stringify(yuhun))) - console.log(this.shikigami.yuhun.yuhunSetEffect); - console.log(this.shikigami.yuhun.yuhunSetEffect[0]); }, cancel() { - console.log("cancel===="); this.$emit("closeProperty"); + Object.assign(this.$data, this.$options.data()) }, confirm() { - console.log("confirm===="); - console.log("confirm====" + JSON.stringify(this.shikigami.edit)) // if (null == this.shikigami[this.index].properties) { this.shikigami.edit = true this.$emit("updateProperty", JSON.parse(JSON.stringify(this.shikigami))); Object.assign(this.$data, this.$options.data()) - console.log("confirm====" + JSON.stringify(this.shikigami.edit)) // } }, updateSkillRequired(index, value) { - console.log(index) - console.log(value) this.shikigami.skillRequired[index] = value; - console.log(this.shikigami.skillRequired) }, }, }; diff --git a/src/components/Yys.vue b/src/components/Yys.vue index dc2f701..9bdb8a6 100644 --- a/src/components/Yys.vue +++ b/src/components/Yys.vue @@ -12,34 +12,64 @@ @closeProperty="closeProperty" @updateProperty="updateProperty" /> + - - - + + + - - - - - {{ element.name || "" }} - - 已配置属性: - - {{ key }} : {{ value || '-' }} - - - - 配置属性 + + + + + + + + + + + + + + + {{ position.name || "" }} + + 配置属性 + + + + + 已配置属性: + + {{ position.properties.yuhun.yuhunSetEffect.map(item => item.name).join(' ') }} + + + + {{ key }} : {{ value || '-' }} + + + + + + + + - - - + + + + + + - - - + + + 配置结果 @@ -62,10 +92,12 @@ const activeName = ref('first') export default { data() { return { - shikigamiData: shikigamiData, showSelectShikigami: false, showProperty: false, - items: [{}, {}, {}, {}, {}], + groups: [ + [{}, {}, {}, {}, {}], + [{}, {}, {}, {}, {}] + ], // items: [ // { // "name": "妖刀姬", @@ -83,7 +115,8 @@ export default { // "avatar":"/assets/Shikigami/ssr/Yoto Hime.png" // } // ], - index: 0, + groupIndex: 0, + positionIndex: 0, currentShikigami: {}, drag: false, }; @@ -101,36 +134,61 @@ export default { this.showSelectShikigami = false; this.currentShikigami = {}; }, - editShikigami(index, item) { - console.log("==== 选择式神 ===", index, item); - this.currentShikigami = item; + editShikigami(groupIndex, positionIndex) { + console.log("==== 选择式神 ===", groupIndex, positionIndex); this.showSelectShikigami = true; - this.index = index; + this.groupIndex = groupIndex; + this.positionIndex = positionIndex; }, updateShikigami(shikigami) { console.log("parent====> ", shikigami); this.showSelectShikigami = false; - this.items[this.index] = shikigami; + + const oldProperties = this.groups[this.groupIndex][this.positionIndex].properties; + this.groups[this.groupIndex][this.positionIndex] = shikigami; + this.groups[this.groupIndex][this.positionIndex].properties = oldProperties; // this.items[this.index].name = shikigami.name; // this.currentShikigami = {}; }, - editProperties(index, item) { - console.log("add properties", index, item); + editProperties(groupIndex, positionIndex) { + this.showProperty = true; - this.currentShikigami = item; - this.index = index; + this.groupIndex = groupIndex; + this.positionIndex = positionIndex; + this.currentShikigami = this.groups[this.groupIndex][this.positionIndex]; + console.log("currentShikigami", JSON.stringify(this.currentShikigami)); }, closeProperty() { - console.log("close property ==="); this.showProperty = false; - this.currentShikigami = {}; + this.currentShikigami = this.groups[this.groupIndex][this.positionIndex]; }, updateProperty(property) { - console.log("parent property====> ", property); this.showProperty = false; this.currentShikigami = {}; - this.items[this.index].properties = property; + this.groups[this.groupIndex][this.positionIndex].properties = property; + }, + removeGroupElement(groupIndex, positionIndex) { + this.groups[groupIndex].splice(positionIndex, 1); + }, + removeGroup(groupIndex) { + this.groups.splice(groupIndex, 1); + }, + addGroup() { + this.groups.push([{}, {}, {}, {}, {}]); + }, + addGroupElement(groupIndex) { + this.groups[groupIndex].push({}); }, }, }; + +