diff --git a/packages/uni-components/src/components/navigator/index.tsx b/packages/uni-components/src/components/navigator/index.tsx index 4be5b0ad6559c5a563fcdc772acb13f560e005dc..ac57c0eb108ecfe74cf208434365cd53bb85e3f4 100644 --- a/packages/uni-components/src/components/navigator/index.tsx +++ b/packages/uni-components/src/components/navigator/index.tsx @@ -2,6 +2,7 @@ import { getCurrentInstance } from 'vue' import { useHover } from '../../helpers/useHover' import { defineBuiltInComponent } from '@dcloudio/uni-components' import { useAttrs } from '../../helpers/useAttrs' +import { onEventPrevent } from '@dcloudio/uni-core' const OPEN_TYPES = [ 'navigate', @@ -58,7 +59,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({ props, setup(props, { slots }) { const vm = getCurrentInstance() - const __scopeId = (vm?.root?.type as any).__scopeId || '' + const __scopeId = (vm && (vm.root.type as any).__scopeId) || '' const { $attrs, $excludeAttrs, $listeners } = useAttrs({ excludeListeners: true, }) @@ -110,12 +111,9 @@ export default /*#__PURE__*/ defineBuiltInComponent({ const hasHoverClass = props.hoverClass && props.hoverClass !== 'none' return ( { - e.preventDefault() - return false - }} - style={{ 'text-decoration': 'none' }} + onClick={onEventPrevent} {...$listeners.value} >