chore: rename emit function

This commit is contained in:
三咲智子 2023-01-02 06:06:27 +08:00
parent 72e03f8109
commit b48a893614
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
5 changed files with 11 additions and 11 deletions

View file

@ -1,7 +1,7 @@
<script lang="ts" setup>
import type { ResolvedCommand } from '@/composables/command'
const emits = defineEmits<{
const emit = defineEmits<{
(event: 'activate'): void
}>()
@ -21,7 +21,7 @@ const {
class="flex px-3 py-2 my-1 items-center rounded-lg hover:bg-active transition-all duration-65 ease-in-out cursor-pointer scroll-m-10"
:class="{ 'bg-active': active }"
:data-index="index"
@click="emits('activate')"
@click="emit('activate')"
>
<div v-if="cmd.icon" me-2 :class="cmd.icon" />

View file

@ -4,14 +4,14 @@ const props = withDefaults(defineProps<{
}>(), {
modelValue: true,
})
const emits = defineEmits<{
const emit = defineEmits<{
(e: 'update:modelValue', v: boolean): void
(event: 'close'): void
}>()
const visible = useVModel(props, 'modelValue', emits, { passive: true })
const visible = useVModel(props, 'modelValue', emit, { passive: true })
function close() {
emits('close')
emit('close')
visible.value = false
}
</script>

View file

@ -16,11 +16,11 @@ const props = withDefaults(defineProps<Props>(), {
stencilSizePercentage: 0.9,
})
const emits = defineEmits<{
const emit = defineEmits<{
(event: 'update:modelValue', value: File): void
}>()
const vmFile = useVModel(props, 'modelValue', emits, { passive: true })
const vmFile = useVModel(props, 'modelValue', emit, { passive: true })
const cropperDialog = ref(false)

View file

@ -2,10 +2,10 @@
const props = defineProps<{
modelValue?: boolean
}>()
const emits = defineEmits<{
const emit = defineEmits<{
(event: 'update:modelValue', value: boolean): void
}>()
const visible = useVModel(props, 'modelValue', emits, { passive: true })
const visible = useVModel(props, 'modelValue', emit, { passive: true })
const colorMode = useColorMode()
function changeShow() {

View file

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { UserLogin } from '~/types'
const emits = defineEmits<{
const emit = defineEmits<{
(event: 'click'): void
}>()
@ -25,7 +25,7 @@ const switchUser = (user: UserLogin) => {
</script>
<template>
<div sm:min-w-80 max-w-100vw mxa py2 flex="~ col" @click="emits('click')">
<div sm:min-w-80 max-w-100vw mxa py2 flex="~ col" @click="emit('click')">
<template v-for="user of sorted" :key="user.id">
<button
flex rounded px4 py3 text-left