mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-01-24 10:33:47 +08:00
chore: perf style
This commit is contained in:
parent
a0b05e7769
commit
e9c28319b4
@ -11,6 +11,7 @@
|
|||||||
import { defineComponent, computed } from 'vue';
|
import { defineComponent, computed } from 'vue';
|
||||||
import { RightOutlined } from '@ant-design/icons-vue';
|
import { RightOutlined } from '@ant-design/icons-vue';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
|
import { useDesign } from '/@/hooks/web/useDesign';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'BasicArrow',
|
name: 'BasicArrow',
|
||||||
@ -23,12 +24,14 @@
|
|||||||
inset: propTypes.bool,
|
inset: propTypes.bool,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
const { prefixCls } = useDesign('basic-arrow');
|
||||||
|
|
||||||
const getClass = computed(() => {
|
const getClass = computed(() => {
|
||||||
const { expand, top, bottom, inset } = props;
|
const { expand, top, bottom, inset } = props;
|
||||||
return [
|
return [
|
||||||
'base-arrow',
|
prefixCls,
|
||||||
{
|
{
|
||||||
'base-arrow__active': expand,
|
[`${prefixCls}--active`]: expand,
|
||||||
top,
|
top,
|
||||||
inset,
|
inset,
|
||||||
bottom,
|
bottom,
|
||||||
@ -43,18 +46,21 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.base-arrow {
|
@import (reference) '../../../design/index.less';
|
||||||
|
@prefix-cls: ~'@{namespace}-basic-arrow';
|
||||||
|
|
||||||
|
.@{prefix-cls} {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
transition: all 0.3s ease 0.1s;
|
transition: all 0.3s ease 0.1s;
|
||||||
transform-origin: center center;
|
transform-origin: center center;
|
||||||
|
|
||||||
&.inset {
|
&--active {
|
||||||
line-height: 0px;
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
&__active {
|
&.inset {
|
||||||
transform: rotate(90deg);
|
line-height: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.top {
|
&.top {
|
||||||
@ -65,11 +71,11 @@
|
|||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.top.base-arrow__active {
|
&.top.@{prefix-cls}--active {
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.bottom.base-arrow__active {
|
&.bottom.@{prefix-cls}--active {
|
||||||
transform: rotate(-90deg);
|
transform: rotate(-90deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
import { isString, isArray } from '/@/utils/is';
|
import { isString, isArray } from '/@/utils/is';
|
||||||
import { getSlot } from '/@/utils/helper/tsxHelper';
|
import { getSlot } from '/@/utils/helper/tsxHelper';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
|
import { useDesign } from '/@/hooks/web/useDesign';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'BasicHelp',
|
name: 'BasicHelp',
|
||||||
components: { Tooltip },
|
components: { Tooltip },
|
||||||
@ -37,6 +38,8 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, { slots }) {
|
setup(props, { slots }) {
|
||||||
|
const { prefixCls } = useDesign('basic-help');
|
||||||
|
|
||||||
const getOverlayStyleRef = computed(
|
const getOverlayStyleRef = computed(
|
||||||
(): CSSProperties => {
|
(): CSSProperties => {
|
||||||
return {
|
return {
|
||||||
@ -86,7 +89,7 @@
|
|||||||
},
|
},
|
||||||
[renderTitle()]
|
[renderTitle()]
|
||||||
),
|
),
|
||||||
overlayClassName: 'base-help__wrap',
|
overlayClassName: `${prefixCls}__wrap`,
|
||||||
autoAdjustOverflow: true,
|
autoAdjustOverflow: true,
|
||||||
overlayStyle: unref(getOverlayStyleRef),
|
overlayStyle: unref(getOverlayStyleRef),
|
||||||
placement: props.placement,
|
placement: props.placement,
|
||||||
@ -97,7 +100,7 @@
|
|||||||
h(
|
h(
|
||||||
'span',
|
'span',
|
||||||
{
|
{
|
||||||
class: 'base-help',
|
class: prefixCls,
|
||||||
style: unref(getMainStyleRef),
|
style: unref(getMainStyleRef),
|
||||||
},
|
},
|
||||||
getSlot(slots) || h(InfoCircleOutlined)
|
getSlot(slots) || h(InfoCircleOutlined)
|
||||||
@ -110,8 +113,9 @@
|
|||||||
</script>
|
</script>
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@import (reference) '../../../design/index.less';
|
@import (reference) '../../../design/index.less';
|
||||||
|
@prefix-cls: ~'@{namespace}-basic-help';
|
||||||
|
|
||||||
.base-help {
|
.@{prefix-cls} {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 6px;
|
margin-left: 6px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<span class="base-title" :class="{ 'show-span': span && $slots.default }">
|
<span :class="[prefixCls, { 'show-span': span && $slots.default }]">
|
||||||
<slot />
|
<slot />
|
||||||
<BasicHelp class="base-title__help" v-if="helpMessage" :text="helpMessage" />
|
<BasicHelp :class="`${prefixCls}__help`" v-if="helpMessage" :text="helpMessage" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
import BasicHelp from './BasicHelp.vue';
|
import BasicHelp from './BasicHelp.vue';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
|
import { useDesign } from '/@/hooks/web/useDesign';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'BasicTitle',
|
name: 'BasicTitle',
|
||||||
@ -22,12 +23,17 @@
|
|||||||
},
|
},
|
||||||
span: propTypes.bool,
|
span: propTypes.bool,
|
||||||
},
|
},
|
||||||
|
setup() {
|
||||||
|
const { prefixCls } = useDesign('basic-title');
|
||||||
|
return { prefixCls };
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@import (reference) '../../../design/index.less';
|
@import (reference) '../../../design/index.less';
|
||||||
|
@prefix-cls: ~'@{namespace}-basic-title';
|
||||||
|
|
||||||
.base-title {
|
.@{prefix-cls} {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding-left: 7px;
|
padding-left: 7px;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="wrapRef"><slot /></div>
|
<div ref="wrap"><slot /></div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
@ -10,13 +10,13 @@
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ClickOutSide',
|
name: 'ClickOutSide',
|
||||||
setup(_, { emit }) {
|
setup(_, { emit }) {
|
||||||
const wrapRef = ref<ElRef>(null);
|
const wrap = ref<ElRef>(null);
|
||||||
|
|
||||||
useClickOutside(wrapRef as Ref<HTMLDivElement>, () => {
|
useClickOutside(wrap as Ref<HTMLDivElement>, () => {
|
||||||
emit('clickOutside');
|
emit('clickOutside');
|
||||||
});
|
});
|
||||||
|
|
||||||
return { wrapRef };
|
return { wrap };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -16,6 +16,7 @@ import { tabStore } from '/@/store/modules/tab';
|
|||||||
import { userStore } from '/@/store/modules/user';
|
import { userStore } from '/@/store/modules/user';
|
||||||
|
|
||||||
import { initAffixTabs, useTabsDrag } from './useMultipleTabs';
|
import { initAffixTabs, useTabsDrag } from './useMultipleTabs';
|
||||||
|
import { REDIRECT_NAME } from '/@/router/constant';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'MultipleTabs',
|
name: 'MultipleTabs',
|
||||||
@ -35,6 +36,9 @@ export default defineComponent({
|
|||||||
watch(
|
watch(
|
||||||
() => tabStore.getLastChangeRouteState?.path,
|
() => tabStore.getLastChangeRouteState?.path,
|
||||||
() => {
|
() => {
|
||||||
|
if (tabStore.getLastChangeRouteState?.name === REDIRECT_NAME) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const lastChangeRoute = unref(tabStore.getLastChangeRouteState);
|
const lastChangeRoute = unref(tabStore.getLastChangeRouteState);
|
||||||
if (!lastChangeRoute || !userStore.getTokenState) return;
|
if (!lastChangeRoute || !userStore.getTokenState) return;
|
||||||
const { path, fullPath } = lastChangeRoute;
|
const { path, fullPath } = lastChangeRoute;
|
||||||
|
Loading…
Reference in New Issue
Block a user