refactor(diy-group): simplify topNavColor and setPagestyle logic
remove redundant null checks for diyData and diyGlobalData, streamline the conditional branches for better readability
This commit is contained in:
@@ -300,21 +300,20 @@ export default {
|
||||
computed: {
|
||||
topNavColor() {
|
||||
var color = '';
|
||||
if (this.diyData && this.diyData.global && this.diyData.global.topNavBg) {
|
||||
if (this.diyData.global.topNavBg) {
|
||||
color = 'transparent';
|
||||
if (this.scrollTop > 20) {
|
||||
color = this.diyData.global.topNavColor;
|
||||
} else {
|
||||
color = 'transparent';
|
||||
}
|
||||
} else if (this.diyData && this.diyData.global) {
|
||||
} else {
|
||||
color = this.diyData.global.topNavColor;
|
||||
}
|
||||
return color;
|
||||
},
|
||||
// 修改属性样式
|
||||
setPagestyle() {
|
||||
if (!this.diyGlobalData || !this.diyGlobalData.value) return [];
|
||||
this.diyGlobalData.value.forEach((item, index) => {
|
||||
item.pageStyle = '';
|
||||
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
|
||||
|
||||
Reference in New Issue
Block a user