ソースを参照

解决 cl-popup teleport 位置异常

icssoa 7 ヶ月 前
コミット
52cbaee590
1 ファイル変更7 行追加2 行削除
  1. 7 2
      uni_modules/cool-ui/components/cl-popup/cl-popup.uvue

+ 7 - 2
uni_modules/cool-ui/components/cl-popup/cl-popup.uvue

@@ -1,10 +1,10 @@
 <template>
 	<!-- #ifdef H5 -->
-	<teleport to="#app">
+	<teleport to="uni-app" :disabled="!enablePortal">
 		<!-- #endif -->
 
 		<!-- #ifdef MP -->
-		<root-portal>
+		<root-portal :enable="enablePortal">
 			<!-- #endif -->
 			<view
 				class="cl-popup-wrapper"
@@ -196,6 +196,11 @@ const props = defineProps({
 	keepAlive: {
 		type: Boolean,
 		default: false
+	},
+	// 是否启用 portal
+	enablePortal: {
+		type: Boolean,
+		default: true
 	}
 });