Content-Length: 421959 | pFad | http://github.com/material-vue/material-vue/commit/17d781bd147b05912607803580e9ba92640a87dc

FF fix: click events · material-vue/material-vue@17d781b · GitHub
Skip to content

Commit 17d781b

Browse files
author
Корпусов Максим
committed
fix: click events
1 parent 620566d commit 17d781b

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

lib/src/components/MCheckbox/MCheckbox.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div
33
class="mv-flex mv-gap-0.5 mv-cursor-pointer mv-items-center"
4-
@click.stop="handleClick"
4+
@click="handleClick"
55
>
66
<div class="mv-w-12 mv-h-12 mv-relative">
77
<div class="mv-absolute mv-inset-1 mv-rounded-full mv-overflow-hidden">
88
<MStateLayer
9+
ref="stateLayer"
910
classes="mv-rounded-full"
1011
:background="stateBackground"
1112
:ripple-background="rippleBackground"
12-
@click="handleClick"
1313
/>
1414
</div>
1515
<span
@@ -45,6 +45,8 @@ const props = defineProps({
4545
},
4646
})
4747
48+
const stateLayer = ref(null)
49+
4850
const localModal = ref()
4951
useLocalModel(props.modelValue, localModal)
5052
@@ -71,9 +73,11 @@ const stateBackground = computed(() => {
7173
: 'background: var(--md-sys-color-on-surface)'
7274
})
7375
74-
const emits = defineEmits(['update:modelValue', 'click'])
76+
const emits = defineEmits(['update:modelValue'])
7577
7678
function handleClick() {
79+
stateLayer.value.animStart({ center: true })
80+
7781
if (typeof localModal.value === 'boolean') {
7882
localModal.value = !localModal.value
7983
} else {
@@ -82,7 +86,6 @@ function handleClick() {
8286
else localModal.value.push(props.value)
8387
}
8488
emits('update:modelValue', localModal.value)
85-
emits('click')
8689
}
8790
</script>
8891

lib/src/components/MRadio/MRadio.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div
33
class="mv-flex mv-gap-0.5 mv-cursor-pointer mv-items-center"
4-
@click.stop="click"
4+
@click="handleClick"
55
>
66
<div class="mv-w-12 mv-h-12 mv-relative">
77
<div class="mv-absolute mv-inset-1 mv-rounded-full mv-overflow-hidden">
88
<MStateLayer
9+
ref="stateLayer"
910
classes="mv-rounded-full"
1011
:background="stateBackground"
1112
:ripple-background="rippleBackground"
12-
@click="click"
1313
/>
1414
</div>
1515
<span
@@ -45,9 +45,11 @@ const props = defineProps({
4545
},
4646
})
4747
48+
const stateLayer = ref(null)
49+
4850
let group = inject(radioGroupModelValueSymbol, undefined)
4951
50-
const emits = defineEmits(['update:modelValue', 'click'])
52+
const emits = defineEmits(['update:modelValue'])
5153
5254
const actualState = ref(group ? group === props.value : props.modelValue)
5355
@@ -79,8 +81,9 @@ const contentColor = computed(() => {
7981
: 'mv-text-[--md-sys-color-on-surface]'
8082
})
8183
82-
function click() {
83-
emits('click')
84+
function handleClick(e) {
85+
stateLayer.value.animStart({ center: true })
86+
8487
if (group === undefined) {
8588
actualState.value = !actualState.value
8689
emits('update:modelValue', actualState.value)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/material-vue/material-vue/commit/17d781bd147b05912607803580e9ba92640a87dc

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy