diff --git a/components-diy/diy-rubik-cube.vue b/components-diy/diy-rubik-cube.vue index 923f8b6..2f43ab5 100644 --- a/components-diy/diy-rubik-cube.vue +++ b/components-diy/diy-rubik-cube.vue @@ -91,7 +91,8 @@ export default { }, data() { return { - customHtml: '' + customHtml: '', + processedList: [] }; }, created() { @@ -99,6 +100,7 @@ export default { this.value.diyHtml = this.value.diyHtml.replace(/"/g, '"'); this.customHtml = htmlParser(this.value.diyHtml); } else { + this.initList(); var singleRow = { 'row1-of2': { ratio: 2, @@ -127,18 +129,20 @@ export default { } } }, - mixins: [DiyMinx], watch: { - // 组件刷新监听 - componentRefresh: function (nval) { } + value: { + handler() { + if (this.value.mode != 'custom-rubik-cube') { + this.initList(); + } + }, + deep: true + } }, + mixins: [DiyMinx], computed: { list() { - var arr = JSON.parse(JSON.stringify(this.value.list)); - arr.forEach((item, index) => { - item.pageItemStyle = this.countBorderRadius(this.value.mode, index); - }); - return arr; + return this.processedList; }, rubikCubeWrapCss() { var obj = ''; @@ -153,6 +157,17 @@ export default { } }, methods: { + initList() { + if (!this.value.list || !Array.isArray(this.value.list)) { + this.processedList = []; + return; + } + this.processedList = this.value.list.map((item, index) => { + const newItem = { ...item }; + newItem.pageItemStyle = this.countBorderRadius(this.value.mode, index); + return newItem; + }); + }, /** * 魔方:单行多个,平分宽度 * 公式: diff --git a/pages/index/index.vue b/pages/index/index.vue index 61e77d8..b22334d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -240,7 +240,7 @@ export default { right: 28rpx !important; bottom: 200rpx !important; /* #endif */ - /* #ifdef MP-WEIXIN */ + /* #ifdef MP */ right: 27rpx !important; bottom: 180rpx !important; /* #endif */