chore(组件): components-diy 必须使用easyncom系统,不然在微信上无法渲染

This commit is contained in:
2026-01-05 09:29:19 +08:00
parent 311efe1ecd
commit b24f77be1a
49 changed files with 1462 additions and 1547 deletions

View File

@@ -47,6 +47,9 @@ export default {
type: Object
}
},
components: {
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
},
mixins: [DiyMinx],
data() {
return {

View File

@@ -293,6 +293,9 @@ export default {
default: false
}
},
components: {
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
},
mixins: [DiyMinx],
data() {
return {

View File

@@ -166,7 +166,7 @@ var contentWrapHeight, query, cartPosition;
// 商品分类
export default {
components: {
components: {
nsGoodsSkuCategory: () => import('@/components/ns-goods-sku/ns-goods-sku-category.vue'),
},
name: 'diy-category',

View File

@@ -258,7 +258,7 @@ import DiyMinx from './minx.js'
// 自定义商品列表展示
export default {
name: 'diy-goods-list',
components: {
components: {
nsGoodsSkuIndex: () => import('@/components/ns-goods-sku/ns-goods-sku-index.vue'),
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
},

View File

@@ -103,7 +103,7 @@ export default {
type: Object
}
},
components: {
components: {
XSkeleton: () => import('@/uni_modules/x-skeleton/components/x-skeleton/x-skeleton.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
},

View File

@@ -251,6 +251,11 @@
<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>
@@ -261,20 +266,24 @@
// 组件组展示
import DiyMinx from './minx.js'
export default {
components: {},
name: 'DiyGroup',
mixins: [DiyMinx],
props: {
diyData: {
type: Object
type: Object,
default: () => ({})
},
scrollTop: {
type: [String, Number],
default: '0'
},
haveTopCategory: {
type: Boolean
type: Boolean,
default: false
},
followOfficialAccount: {
type: Object
type: Object,
default: () => ({})
},
},
mixins: [DiyMinx],
@@ -284,25 +293,28 @@ 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.topNavBg) {
if (this.diyData.global && this.diyData.global.topNavBg) {
color = 'transparent';
if (this.scrollTop > 20) {
if (this.scrollTop > 20 && this.diyData.global.topNavColor) {
color = this.diyData.global.topNavColor;
} else {
color = 'transparent';
}
} else {
} else if (this.diyData.global && this.diyData.global.topNavColor) {
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 = '';
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
@@ -314,12 +326,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 * 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' + ';';
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' + ';';
}
});
@@ -327,20 +339,35 @@ export default {
},
// 过滤组件的渲染
diyDataArray() {
let data = [],
showModuleData = this.$store.state.diyGroupShowModule ? JSON.parse(this.$store.state
.diyGroupShowModule) : '';
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 = [];
}
const diyDataArr = this.setPagestyle;
if (showModuleData.length) {
if (showModuleData.includes('null')) return [];
let diyDataArr = this.setPagestyle;
diyDataArr.forEach((item, index) => {
if (showModuleData.includes(item.componentName)) {
if (item && item.componentName && showModuleData.includes(item.componentName)) {
data.push(item);
}
});
} else data = this.setPagestyle;
} else {
data = diyDataArr;
}
return data;
}
},

View File

@@ -51,7 +51,7 @@
// 文章
import DiyMinx from './minx.js'
export default {
name: 'diy-article',
name: 'diy-merch-list',
props: {
value: {
type: Object