File tree 2 files changed +15
-9
lines changed 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div
3
3
class =" mv-flex mv-gap-0.5 mv-cursor-pointer mv-items-center"
4
- @click.stop =" handleClick"
4
+ @click =" handleClick"
5
5
>
6
6
<div class =" mv-w-12 mv-h-12 mv-relative" >
7
7
<div class =" mv-absolute mv-inset-1 mv-rounded-full mv-overflow-hidden" >
8
8
<MStateLayer
9
+ ref =" stateLayer"
9
10
classes =" mv-rounded-full"
10
11
:background =" stateBackground"
11
12
:ripple-background =" rippleBackground"
12
- @click =" handleClick"
13
13
/>
14
14
</div >
15
15
<span
@@ -45,6 +45,8 @@ const props = defineProps({
45
45
},
46
46
})
47
47
48
+ const stateLayer = ref (null )
49
+
48
50
const localModal = ref ()
49
51
useLocalModel (props .modelValue , localModal)
50
52
@@ -71,9 +73,11 @@ const stateBackground = computed(() => {
71
73
: ' background: var(--md-sys-color-on-surface)'
72
74
})
73
75
74
- const emits = defineEmits ([' update:modelValue' , ' click ' ])
76
+ const emits = defineEmits ([' update:modelValue' ])
75
77
76
78
function handleClick () {
79
+ stateLayer .value .animStart ({ center: true })
80
+
77
81
if (typeof localModal .value === ' boolean' ) {
78
82
localModal .value = ! localModal .value
79
83
} else {
@@ -82,7 +86,6 @@ function handleClick() {
82
86
else localModal .value .push (props .value )
83
87
}
84
88
emits (' update:modelValue' , localModal .value )
85
- emits (' click' )
86
89
}
87
90
</script >
88
91
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div
3
3
class =" mv-flex mv-gap-0.5 mv-cursor-pointer mv-items-center"
4
- @click.stop = " click "
4
+ @click = " handleClick "
5
5
>
6
6
<div class =" mv-w-12 mv-h-12 mv-relative" >
7
7
<div class =" mv-absolute mv-inset-1 mv-rounded-full mv-overflow-hidden" >
8
8
<MStateLayer
9
+ ref =" stateLayer"
9
10
classes =" mv-rounded-full"
10
11
:background =" stateBackground"
11
12
:ripple-background =" rippleBackground"
12
- @click =" click"
13
13
/>
14
14
</div >
15
15
<span
@@ -45,9 +45,11 @@ const props = defineProps({
45
45
},
46
46
})
47
47
48
+ const stateLayer = ref (null )
49
+
48
50
let group = inject (radioGroupModelValueSymbol, undefined )
49
51
50
- const emits = defineEmits ([' update:modelValue' , ' click ' ])
52
+ const emits = defineEmits ([' update:modelValue' ])
51
53
52
54
const actualState = ref (group ? group === props .value : props .modelValue )
53
55
@@ -79,8 +81,9 @@ const contentColor = computed(() => {
79
81
: ' mv-text-[--md-sys-color-on-surface]'
80
82
})
81
83
82
- function click () {
83
- emits (' click' )
84
+ function handleClick (e ) {
85
+ stateLayer .value .animStart ({ center: true })
86
+
84
87
if (group === undefined ) {
85
88
actualState .value = ! actualState .value
86
89
emits (' update:modelValue' , actualState .value )
You can’t perform that action at this time.
0 commit comments