initial
This commit is contained in:
42
layers/ui/components/dropdown/item.vue
Normal file
42
layers/ui/components/dropdown/item.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<li
|
||||
:class="[cn.b(), cn.is('active', active)]"
|
||||
tabindex="0"
|
||||
@click="onClick"
|
||||
>
|
||||
<div
|
||||
v-if="$slots.icon"
|
||||
:class="[cn.e('icon')]"
|
||||
>
|
||||
<slot name="icon" />
|
||||
</div>
|
||||
|
||||
<slot />
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { inject } from 'vue'
|
||||
import useClassname from '../../composables/use-classname'
|
||||
import { dropdownContextKey } from './constants'
|
||||
|
||||
export interface Props {
|
||||
active?: boolean
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: 'UiSpinner',
|
||||
})
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
active: false,
|
||||
})
|
||||
|
||||
const dropdown = inject(dropdownContextKey)
|
||||
|
||||
const cn = useClassname('ui-dropdown-item')
|
||||
|
||||
function onClick() {
|
||||
dropdown.handleItemClick()
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user