feat(components): 添加多页签Tab点击后自动往中间滚动

This commit is contained in:
Soybean
2021-11-25 00:50:55 +08:00
parent 1ffb75afce
commit 8ce627a397
6 changed files with 48 additions and 8 deletions

View File

@ -41,5 +41,7 @@ watch([() => width.value, () => height.value], () => {
onMounted(() => {
initBetterScroll();
});
defineExpose({ bsInstance });
</script>
<style scoped></style>

View File

@ -1,7 +1,7 @@
<template>
<div
class="relative flex-y-center h-34px px-24px cursor-pointer -mr-18px"
:class="{ 'z-10': isActive, 'z-9': isHover }"
class="relative flex-y-center h-34px px-24px cursor-pointer"
:class="{ '-mr-18px': !isLast, 'z-10': isActive, 'z-9': isHover }"
@mouseenter="setTrue"
@mouseleave="setFalse"
>
@ -39,14 +39,18 @@ interface Props {
closable?: boolean;
/** 暗黑模式 */
darkMode?: boolean;
/** 是否是最后一个 */
isLast: boolean;
}
withDefaults(defineProps<Props>(), {
isActive: false,
primaryColor: '#409EFF',
closable: true,
darkMode: false
darkMode: false,
isLast: false
});
const emit = defineEmits<{
/** 点击关闭图标 */
(e: 'close'): void;