mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-03 22:39:52 +08:00
35 lines
758 B
Vue
35 lines
758 B
Vue
<template>
|
|
<component class="tmagic-design-dropdown" :is="uiComponent" v-bind="uiProps" @command="commandHandler">
|
|
<slot></slot>
|
|
|
|
<template #dropdown>
|
|
<slot name="dropdown"></slot>
|
|
</template>
|
|
</component>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue';
|
|
|
|
import { getConfig } from './config';
|
|
import type { DropdownProps } from './types';
|
|
|
|
defineOptions({
|
|
name: 'TMDropdown',
|
|
});
|
|
|
|
const props = defineProps<DropdownProps>();
|
|
|
|
const ui = getConfig('components')?.dropdown;
|
|
|
|
const uiComponent = ui?.component || 'el-dropdown';
|
|
|
|
const uiProps = computed(() => ui?.props(props) || props);
|
|
|
|
const emit = defineEmits(['command']);
|
|
|
|
const commandHandler = (...args: any[]) => {
|
|
emit('command', ...args);
|
|
};
|
|
</script>
|