shish пре 1 дан
родитељ
комит
8bf2001c23
2 измењених фајлова са 19 додато и 4 уклоњено
  1. 18 4
      mallApp/src/components/item/plugin/modal.vue
  2. 1 0
      mallApp/src/pages/home/cart.vue

+ 18 - 4
mallApp/src/components/item/plugin/modal.vue

@@ -110,11 +110,28 @@ export default {
 		fadein: {
 			type: Boolean,
 			default: false
+		},
+		/**
+		 * 是否使用 customContent 插槽
+		 * 小程序端勿用 $slots 判断(会触发 then 未定义告警),由页面显式传入
+		 */
+		useCustomContent: {
+			type: Boolean,
+			default: false
 		}
 	},
 	computed:{
+		/** 优先用 prop;H5 可兜底读 slot(避免仅依赖 $slots 在 MP 上报错) */
 		isCustomContent(){
-			return !!this.$slots.customContent
+			if (this.useCustomContent) {
+				return true
+			}
+			// #ifdef H5
+			return !!(this.$slots && this.$slots.customContent)
+			// #endif
+			// #ifndef H5
+			return false
+			// #endif
 		}
 	},
 	data() {
@@ -122,9 +139,6 @@ export default {
 
 		}
 	},
-	mounted(){
-		console.log(this)
-	},
 	methods: {
 		handleClick(e) {
 			if (!this.show) return

+ 1 - 0
mallApp/src/pages/home/cart.vue

@@ -126,6 +126,7 @@
     <!-- 自定义扎数 -->
     <modal-module
       :show="isModel"
+      :use-custom-content="true"
       @cancel="modalCancel"
       @click="affirm"
       :title="customModalTitle"