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

59 lines
1.3 KiB
Vue
Raw Normal View History

2023-11-17 08:45:00 +08:00
<script setup lang="ts">
2023-12-14 21:45:29 +08:00
import type { PageTabProps } from '../../types';
2023-11-17 08:45:00 +08:00
import ChromeTabBg from './chrome-tab-bg.vue';
import style from './index.module.css';
defineOptions({
name: 'ChromeTab'
});
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 cursor-pointer items-center justify-center gap-16px whitespace-nowrap px-24px py-6px -mr-18px"
2023-12-14 21:45:29 +08:00
:class="[
style['chrome-tab'],
{ [style['chrome-tab_dark']]: darkMode },
{ [style['chrome-tab_active']]: active },
{ [style['chrome-tab_active_dark']]: active && darkMode }
]"
>
<div class=":soy: pointer-events-none absolute left-0 top-0 h-full w-full -z-1" :class="[style['chrome-tab__bg']]">
2023-12-14 21:45:29 +08:00
<ChromeTabBg />
</div>
<slot name="prefix"></slot>
<slot></slot>
<slot name="suffix"></slot>
<div class=":soy: absolute right-7px h-16px w-1px bg-#1f2225" :class="[style['chrome-tab-divider']]"></div>
2023-12-14 21:45:29 +08:00
</div>
</template>
2023-11-17 08:45:00 +08:00
<style scoped></style>