File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
packages/uni-components/src Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -45,16 +45,19 @@ export function useHover(props: UseHoverOptions) {
4545 if ( evt . touches . length > 1 ) {
4646 return
4747 }
48- handleHover ( evt )
48+ handleHoverStart ( evt )
4949 }
5050
5151 function onMousedown ( evt : MouseEvent ) {
52- evt . preventDefault ( )
53- handleHover ( evt )
52+ if ( hoverTouch ) {
53+ return
54+ }
55+
56+ handleHoverStart ( evt )
5457 window . addEventListener ( 'mouseup' , handlePCHoverEnd )
5558 }
5659
57- function handleHover ( evt : TouchEvent | MouseEvent ) {
60+ function handleHoverStart ( evt : TouchEvent | MouseEvent ) {
5861 // TODO detect scrolling
5962 if ( ( evt as any ) . _hoverPropagationStopped ) {
6063 return
@@ -80,6 +83,10 @@ export function useHover(props: UseHoverOptions) {
8083 }
8184
8285 function onMouseup ( ) {
86+ if ( ! hoverTouch ) {
87+ return
88+ }
89+
8390 handlePCHoverEnd ( )
8491 }
8592
Original file line number Diff line number Diff line change @@ -27,7 +27,12 @@ export default /*#__PURE__*/ defineBuiltInComponent({
2727 const hasHoverClass = props . hoverClass && props . hoverClass !== 'none'
2828
2929 return (
30- < a class = "navigator-wrap" href = { url } onClick = { onEventPrevent } >
30+ < a
31+ class = "navigator-wrap"
32+ href = { url }
33+ onClick = { onEventPrevent }
34+ onMousedown = { onEventPrevent }
35+ >
3136 < uni-navigator
3237 class = { hasHoverClass && hovering . value ? hoverClass : '' }
3338 { ...( hasHoverClass && binding ) }
You can’t perform that action at this time.
0 commit comments