2022-11-24 08:34:05 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { dropdownContextKey } from './ctx'
|
|
|
|
|
|
|
|
defineProps<{
|
2022-11-24 09:15:58 +00:00
|
|
|
description?: string
|
2022-11-24 08:34:05 +00:00
|
|
|
icon?: string
|
2022-11-24 09:15:58 +00:00
|
|
|
checked?: boolean
|
2022-11-24 08:34:05 +00:00
|
|
|
}>()
|
|
|
|
const emit = defineEmits(['click'])
|
|
|
|
|
|
|
|
const { hide } = inject(dropdownContextKey)!
|
|
|
|
|
|
|
|
const handleClick = (evt: MouseEvent) => {
|
|
|
|
hide()
|
|
|
|
emit('click', evt)
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-11-24 09:15:58 +00:00
|
|
|
<div
|
|
|
|
flex gap-3 items-center cursor-pointer px4 py3 hover-bg-active
|
|
|
|
@click="handleClick"
|
|
|
|
>
|
2022-11-24 08:34:05 +00:00
|
|
|
<div v-if="icon" :class="icon" />
|
2022-11-24 09:15:58 +00:00
|
|
|
<div flex="~ col">
|
|
|
|
<div text-15px font-700>
|
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
<div text-3 text="gray/90">
|
|
|
|
<slot name="description">
|
|
|
|
<p v-if="description">
|
|
|
|
{{ description }}
|
|
|
|
</p>
|
|
|
|
</slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div flex-auto />
|
|
|
|
|
|
|
|
<div v-if="checked" i-ri:check-line />
|
2022-11-24 08:34:05 +00:00
|
|
|
</div>
|
|
|
|
</template>
|