ruoyi-plus-soybean/packages/materials/src/libs/page-tab/button-tab.vue

54 lines
1.0 KiB
Vue
Raw Normal View History

2023-11-17 08:45:00 +08:00
<script setup lang="ts">
import type { PageTabProps } from '../../types';
2023-12-14 21:45:29 +08:00
import style from './index.module.css';
2023-11-17 08:45:00 +08:00
defineOptions({
name: 'ButtonTab'
});
defineProps<PageTabProps>();
type SlotFn = (props?: Record<string, unknown>) => any;
type Slots = {
/**
2023-12-14 21:45:29 +08:00
* Slot
*
* The center content of the tab
2023-11-17 08:45:00 +08:00
*/
default?: SlotFn;
/**
2023-12-14 21:45:29 +08:00
* Slot
*
* The left content of the tab
2023-11-17 08:45:00 +08:00
*/
prefix?: SlotFn;
/**
2023-12-14 21:45:29 +08:00
* Slot
*
* The right content of the tab
2023-11-17 08:45:00 +08:00
*/
suffix?: SlotFn;
};
defineSlots<Slots>();
2023-11-17 08:45:00 +08:00
</script>
2023-12-14 21:45:29 +08:00
<template>
<div
class=":soy: relative inline-flex justify-center items-center gap-12px px-12px py-4px border-1px border-solid rounded-4px cursor-pointer whitespace-nowrap"
:class="[
style['button-tab'],
{ [style['button-tab_dark']]: darkMode },
{ [style['button-tab_active']]: active },
{ [style['button-tab_active_dark']]: active && darkMode }
]"
>
<slot name="prefix"></slot>
<slot></slot>
<slot name="suffix"></slot>
</div>
</template>
2023-11-17 08:45:00 +08:00
<style scoped></style>