revert: 所有代码与custom/common分支同
This commit is contained in:
@@ -251,11 +251,6 @@
|
||||
<diy-icon :value="item"></diy-icon>
|
||||
</template>
|
||||
|
||||
<template v-if="item.componentName == 'Group'">
|
||||
<!-- 组件组 -->
|
||||
<diy-group :diyData="item"></diy-group>
|
||||
</template>
|
||||
|
||||
<!-- 自定义扩展组件 -->
|
||||
<diy-comp-extend :value="item"></diy-comp-extend>
|
||||
</view>
|
||||
@@ -266,24 +261,20 @@
|
||||
// 组件组展示
|
||||
import DiyMinx from './minx.js'
|
||||
export default {
|
||||
name: 'DiyGroup',
|
||||
mixins: [DiyMinx],
|
||||
components: {},
|
||||
props: {
|
||||
diyData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
type: Object
|
||||
},
|
||||
scrollTop: {
|
||||
type: [String, Number],
|
||||
default: '0'
|
||||
},
|
||||
haveTopCategory: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
type: Boolean
|
||||
},
|
||||
followOfficialAccount: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
type: Object
|
||||
},
|
||||
},
|
||||
mixins: [DiyMinx],
|
||||
@@ -293,28 +284,25 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData || {}));
|
||||
this.diyGlobalData = JSON.parse(JSON.stringify(this.diyData));
|
||||
},
|
||||
computed: {
|
||||
topNavColor() {
|
||||
var color = '';
|
||||
if (this.diyData.global && this.diyData.global.topNavBg) {
|
||||
if (this.diyData.global.topNavBg) {
|
||||
color = 'transparent';
|
||||
if (this.scrollTop > 20 && this.diyData.global.topNavColor) {
|
||||
if (this.scrollTop > 20) {
|
||||
color = this.diyData.global.topNavColor;
|
||||
} else {
|
||||
color = 'transparent';
|
||||
}
|
||||
} else if (this.diyData.global && this.diyData.global.topNavColor) {
|
||||
} else {
|
||||
color = this.diyData.global.topNavColor;
|
||||
}
|
||||
return color;
|
||||
},
|
||||
// 修改属性样式
|
||||
setPagestyle() {
|
||||
if (!this.diyGlobalData || !this.diyGlobalData.value || !Array.isArray(this.diyGlobalData.value)) {
|
||||
return [];
|
||||
}
|
||||
this.diyGlobalData.value.forEach((item, index) => {
|
||||
item.pageStyle = '';
|
||||
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
|
||||
@@ -326,12 +314,12 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
item.pageStyle += 'background-color:' + (item.pageBgColor || '') + ';';
|
||||
item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
||||
if (item.margin) {
|
||||
item.pageStyle += 'padding-top:' + (item.margin.top || 0) * 2 + 'rpx' + ';';
|
||||
item.pageStyle += 'padding-bottom:' + (item.margin.bottom || 0) * 2 + 'rpx' + ';';
|
||||
item.pageStyle += 'padding-right:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
|
||||
item.pageStyle += 'padding-left:' + (item.margin.both || 0) * 2 + 'rpx' + ';';
|
||||
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
||||
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
||||
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
||||
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
||||
}
|
||||
});
|
||||
|
||||
@@ -339,35 +327,20 @@ export default {
|
||||
},
|
||||
// 过滤组件的渲染
|
||||
diyDataArray() {
|
||||
let data = [];
|
||||
let showModuleData = [];
|
||||
|
||||
// 安全获取store中的模块显示数据
|
||||
try {
|
||||
if (this.$store && this.$store.state && this.$store.state.diyGroupShowModule) {
|
||||
showModuleData = JSON.parse(this.$store.state.diyGroupShowModule);
|
||||
// 确保showModuleData是数组
|
||||
if (!Array.isArray(showModuleData)) {
|
||||
showModuleData = [];
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
showModuleData = [];
|
||||
}
|
||||
let data = [],
|
||||
showModuleData = this.$store.state.diyGroupShowModule ? JSON.parse(this.$store.state
|
||||
.diyGroupShowModule) : '';
|
||||
|
||||
const diyDataArr = this.setPagestyle;
|
||||
|
||||
if (showModuleData.length) {
|
||||
if (showModuleData.includes('null')) return [];
|
||||
|
||||
let diyDataArr = this.setPagestyle;
|
||||
diyDataArr.forEach((item, index) => {
|
||||
if (item && item.componentName && showModuleData.includes(item.componentName)) {
|
||||
if (showModuleData.includes(item.componentName)) {
|
||||
data.push(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
data = diyDataArr;
|
||||
}
|
||||
} else data = this.setPagestyle;
|
||||
return data;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user