File tree 1 file changed +16
-6
lines changed
src/components/views/settings
1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -20,21 +20,31 @@ const sections: Section[] = [
20
20
{ title: ' menu__links' , reference: ref () },
21
21
];
22
22
23
- const focus = ref (false );
23
+ const focus = ref ();
24
24
const target = ref ();
25
25
26
26
const scrollTo = (section : Section ) => {
27
27
target .value = section ;
28
- focus .value = true ;
28
+ focus .value = section ;
29
29
section .reference ?.value ?.[0 ]?.$el ?.scrollIntoView ({
30
30
behavior: ' smooth' ,
31
31
block: ' center' ,
32
32
});
33
33
};
34
34
35
+ const onEnter = (section : Section ) => {
36
+ target .value = section ;
37
+ };
38
+
39
+ const onLeave = (section : Section ) => {
40
+ if (focus .value ?.title === section ?.title ) {
41
+ focus .value = undefined ;
42
+ }
43
+ };
44
+
35
45
onDeactivated (() => {
36
46
target .value = undefined ;
37
- focus .value = false ;
47
+ focus .value = undefined ;
38
48
});
39
49
</script >
40
50
@@ -73,10 +83,10 @@ onDeactivated(() => {
73
83
:ref =" section.reference"
74
84
:key =" section.title"
75
85
class =" card"
76
- :class =" { target: focus && target ?.title === section.title }"
86
+ :class =" { target: focus?.title === section.title }"
77
87
:title =" i18n(section.title)"
78
- @mouseenter =" target = section"
79
- @mouseleave =" focus = false "
88
+ @mouseenter =" onEnter( section) "
89
+ @mouseleave =" onLeave(section) "
80
90
>
81
91
card Content
82
92
</NCard >
You can’t perform that action at this time.
0 commit comments