fix: image edit dialog apply button (#527)

This commit is contained in:
Clark Cui 2022-12-23 22:08:10 +08:00 committed by GitHub
parent 0d4df4b269
commit 4b70c6b3e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,13 +10,17 @@ const props = withDefaults(defineProps<{
removable: true,
})
defineEmits<{
const emit = defineEmits<{
(evt: 'remove'): void
(evt: 'setDescription', description: string): void
}>()
const isEditDialogOpen = ref(false)
const description = ref(props.attachment.description ?? '')
const toggleApply = () => {
isEditDialogOpen.value = false
emit('setDescription', unref(description))
}
</script>
<template>
@ -52,7 +56,7 @@ const description = ref(props.attachment.description ?? '')
</h1>
<div flex flex-col gap-2>
<textarea v-model="description" p-3 h-50 bg-base rounded-2 border-strong border-1 md:w-100 />
<button btn-outline @click="$emit('setDescription', description)">
<button btn-outline @click="toggleApply">
{{ $t('action.apply') }}
</button>
</div>