chore: rename emit function

zio/stable
三咲智子 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> <script lang="ts" setup>
import type { ResolvedCommand } from '@/composables/command' import type { ResolvedCommand } from '@/composables/command'
const emits = defineEmits<{ const emit = defineEmits<{
(event: 'activate'): void (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="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 }" :class="{ 'bg-active': active }"
:data-index="index" :data-index="index"
@click="emits('activate')" @click="emit('activate')"
> >
<div v-if="cmd.icon" me-2 :class="cmd.icon" /> <div v-if="cmd.icon" me-2 :class="cmd.icon" />

View File

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

View File

@ -16,11 +16,11 @@ const props = withDefaults(defineProps<Props>(), {
stencilSizePercentage: 0.9, stencilSizePercentage: 0.9,
}) })
const emits = defineEmits<{ const emit = defineEmits<{
(event: 'update:modelValue', value: File): void (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) const cropperDialog = ref(false)

View File

@ -2,10 +2,10 @@
const props = defineProps<{ const props = defineProps<{
modelValue?: boolean modelValue?: boolean
}>() }>()
const emits = defineEmits<{ const emit = defineEmits<{
(event: 'update:modelValue', value: boolean): void (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() const colorMode = useColorMode()
function changeShow() { function changeShow() {

View File

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { UserLogin } from '~/types' import type { UserLogin } from '~/types'
const emits = defineEmits<{ const emit = defineEmits<{
(event: 'click'): void (event: 'click'): void
}>() }>()
@ -25,7 +25,7 @@ const switchUser = (user: UserLogin) => {
</script> </script>
<template> <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"> <template v-for="user of sorted" :key="user.id">
<button <button
flex rounded px4 py3 text-left flex rounded px4 py3 text-left