From 067d87265583624c28e43b893db1f867bd3ca549 Mon Sep 17 00:00:00 2001
From: DCloud_LXH <283700113@qq.com>
Date: Thu, 9 Feb 2023 16:29:54 +0800
Subject: [PATCH] fix(H5): Navigator add properties to control SSR rendering
question/162590
---
.../src/vue/navigator/index.tsx | 38 ++++++++++++-------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/packages/uni-components/src/vue/navigator/index.tsx b/packages/uni-components/src/vue/navigator/index.tsx
index 148684f441..1fc34c0c21 100644
--- a/packages/uni-components/src/vue/navigator/index.tsx
+++ b/packages/uni-components/src/vue/navigator/index.tsx
@@ -1,4 +1,5 @@
import { getCurrentInstance } from 'vue'
+import { extend } from '@vue/shared'
import { defineBuiltInComponent } from '@dcloudio/uni-components'
import { onEventPrevent } from '@dcloudio/uni-core'
@@ -14,7 +15,12 @@ export default /*#__PURE__*/ defineBuiltInComponent({
compatConfig: {
MODE: 3,
},
- props: navigatorProps,
+ props: extend({}, navigatorProps, {
+ ssr: {
+ type: Boolean,
+ default: true,
+ },
+ }),
setup(props, { slots }) {
const vm = getCurrentInstance()
const __scopeId = (vm && vm.vnode.scopeId) || ''
@@ -26,25 +32,31 @@ export default /*#__PURE__*/ defineBuiltInComponent({
const { hoverClass, url } = props
const hasHoverClass = props.hoverClass && props.hoverClass !== 'none'
- return (
+ const navigatorTsx = (
+
+ {slots.default && slots.default()}
+
+ )
+
+ return props.ssr ? (
-
- {slots.default && slots.default()}
-
+ {navigatorTsx}
+ ) : (
+ navigatorTsx
)
}
},
--
GitLab