1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-19 15:29:59 +00:00
elk/components/common/CommonAlert.vue

32 lines
687 B
Vue
Raw Normal View History

2022-12-11 10:52:36 +00:00
<script lang="ts" setup>
const props = withDefaults(defineProps<{
modelValue?: boolean
}>(), {
modelValue: true,
})
2023-01-01 22:06:27 +00:00
const emit = defineEmits<{
2022-12-11 10:52:36 +00:00
(e: 'update:modelValue', v: boolean): void
(event: 'close'): void
}>()
2023-01-01 22:06:27 +00:00
const visible = useVModel(props, 'modelValue', emit, { passive: true })
2022-12-11 10:52:36 +00:00
function close() {
2023-01-01 22:06:27 +00:00
emit('close')
2022-12-11 10:52:36 +00:00
visible.value = false
}
</script>
<template>
<div
flex="~ gap-2" justify-between items-center
2022-12-27 22:18:16 +00:00
border="b base" text-sm text-secondary px4 py2 sm:py4
2022-12-11 10:52:36 +00:00
>
<div>
<slot />
</div>
<button text-xl hover:text-primary bg-hover-overflow w-1.4em h-1.4em @click="close()">
<div i-ri:close-line />
</button>
</div>
</template>