Commit e9c28319b4885e83c708046524461eab5a2cce7e
1 parent
a0b05e77
chore: perf style
Showing
5 changed files
with
39 additions
and
19 deletions
src/components/Basic/src/BasicArrow.vue
@@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
11 | import { defineComponent, computed } from 'vue'; | 11 | import { defineComponent, computed } from 'vue'; |
12 | import { RightOutlined } from '@ant-design/icons-vue'; | 12 | import { RightOutlined } from '@ant-design/icons-vue'; |
13 | import { propTypes } from '/@/utils/propTypes'; | 13 | import { propTypes } from '/@/utils/propTypes'; |
14 | + import { useDesign } from '/@/hooks/web/useDesign'; | ||
14 | 15 | ||
15 | export default defineComponent({ | 16 | export default defineComponent({ |
16 | name: 'BasicArrow', | 17 | name: 'BasicArrow', |
@@ -23,12 +24,14 @@ | @@ -23,12 +24,14 @@ | ||
23 | inset: propTypes.bool, | 24 | inset: propTypes.bool, |
24 | }, | 25 | }, |
25 | setup(props) { | 26 | setup(props) { |
27 | + const { prefixCls } = useDesign('basic-arrow'); | ||
28 | + | ||
26 | const getClass = computed(() => { | 29 | const getClass = computed(() => { |
27 | const { expand, top, bottom, inset } = props; | 30 | const { expand, top, bottom, inset } = props; |
28 | return [ | 31 | return [ |
29 | - 'base-arrow', | 32 | + prefixCls, |
30 | { | 33 | { |
31 | - 'base-arrow__active': expand, | 34 | + [`${prefixCls}--active`]: expand, |
32 | top, | 35 | top, |
33 | inset, | 36 | inset, |
34 | bottom, | 37 | bottom, |
@@ -43,18 +46,21 @@ | @@ -43,18 +46,21 @@ | ||
43 | }); | 46 | }); |
44 | </script> | 47 | </script> |
45 | <style lang="less" scoped> | 48 | <style lang="less" scoped> |
46 | - .base-arrow { | 49 | + @import (reference) '../../../design/index.less'; |
50 | + @prefix-cls: ~'@{namespace}-basic-arrow'; | ||
51 | + | ||
52 | + .@{prefix-cls} { | ||
47 | display: inline-block; | 53 | display: inline-block; |
48 | transform: rotate(0deg); | 54 | transform: rotate(0deg); |
49 | transition: all 0.3s ease 0.1s; | 55 | transition: all 0.3s ease 0.1s; |
50 | transform-origin: center center; | 56 | transform-origin: center center; |
51 | 57 | ||
52 | - &.inset { | ||
53 | - line-height: 0px; | 58 | + &--active { |
59 | + transform: rotate(90deg); | ||
54 | } | 60 | } |
55 | 61 | ||
56 | - &__active { | ||
57 | - transform: rotate(90deg); | 62 | + &.inset { |
63 | + line-height: 0px; | ||
58 | } | 64 | } |
59 | 65 | ||
60 | &.top { | 66 | &.top { |
@@ -65,11 +71,11 @@ | @@ -65,11 +71,11 @@ | ||
65 | transform: rotate(90deg); | 71 | transform: rotate(90deg); |
66 | } | 72 | } |
67 | 73 | ||
68 | - &.top.base-arrow__active { | 74 | + &.top.@{prefix-cls}--active { |
69 | transform: rotate(90deg); | 75 | transform: rotate(90deg); |
70 | } | 76 | } |
71 | 77 | ||
72 | - &.bottom.base-arrow__active { | 78 | + &.bottom.@{prefix-cls}--active { |
73 | transform: rotate(-90deg); | 79 | transform: rotate(-90deg); |
74 | } | 80 | } |
75 | } | 81 | } |
src/components/Basic/src/BasicHelp.vue
@@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
9 | import { isString, isArray } from '/@/utils/is'; | 9 | import { isString, isArray } from '/@/utils/is'; |
10 | import { getSlot } from '/@/utils/helper/tsxHelper'; | 10 | import { getSlot } from '/@/utils/helper/tsxHelper'; |
11 | import { propTypes } from '/@/utils/propTypes'; | 11 | import { propTypes } from '/@/utils/propTypes'; |
12 | + import { useDesign } from '/@/hooks/web/useDesign'; | ||
12 | export default defineComponent({ | 13 | export default defineComponent({ |
13 | name: 'BasicHelp', | 14 | name: 'BasicHelp', |
14 | components: { Tooltip }, | 15 | components: { Tooltip }, |
@@ -37,6 +38,8 @@ | @@ -37,6 +38,8 @@ | ||
37 | }, | 38 | }, |
38 | }, | 39 | }, |
39 | setup(props, { slots }) { | 40 | setup(props, { slots }) { |
41 | + const { prefixCls } = useDesign('basic-help'); | ||
42 | + | ||
40 | const getOverlayStyleRef = computed( | 43 | const getOverlayStyleRef = computed( |
41 | (): CSSProperties => { | 44 | (): CSSProperties => { |
42 | return { | 45 | return { |
@@ -86,7 +89,7 @@ | @@ -86,7 +89,7 @@ | ||
86 | }, | 89 | }, |
87 | [renderTitle()] | 90 | [renderTitle()] |
88 | ), | 91 | ), |
89 | - overlayClassName: 'base-help__wrap', | 92 | + overlayClassName: `${prefixCls}__wrap`, |
90 | autoAdjustOverflow: true, | 93 | autoAdjustOverflow: true, |
91 | overlayStyle: unref(getOverlayStyleRef), | 94 | overlayStyle: unref(getOverlayStyleRef), |
92 | placement: props.placement, | 95 | placement: props.placement, |
@@ -97,7 +100,7 @@ | @@ -97,7 +100,7 @@ | ||
97 | h( | 100 | h( |
98 | 'span', | 101 | 'span', |
99 | { | 102 | { |
100 | - class: 'base-help', | 103 | + class: prefixCls, |
101 | style: unref(getMainStyleRef), | 104 | style: unref(getMainStyleRef), |
102 | }, | 105 | }, |
103 | getSlot(slots) || h(InfoCircleOutlined) | 106 | getSlot(slots) || h(InfoCircleOutlined) |
@@ -110,8 +113,9 @@ | @@ -110,8 +113,9 @@ | ||
110 | </script> | 113 | </script> |
111 | <style lang="less"> | 114 | <style lang="less"> |
112 | @import (reference) '../../../design/index.less'; | 115 | @import (reference) '../../../design/index.less'; |
116 | + @prefix-cls: ~'@{namespace}-basic-help'; | ||
113 | 117 | ||
114 | - .base-help { | 118 | + .@{prefix-cls} { |
115 | display: inline-block; | 119 | display: inline-block; |
116 | margin-left: 6px; | 120 | margin-left: 6px; |
117 | font-size: 14px; | 121 | font-size: 14px; |
src/components/Basic/src/BasicTitle.vue
1 | <template> | 1 | <template> |
2 | - <span class="base-title" :class="{ 'show-span': span && $slots.default }"> | 2 | + <span :class="[prefixCls, { 'show-span': span && $slots.default }]"> |
3 | <slot /> | 3 | <slot /> |
4 | - <BasicHelp class="base-title__help" v-if="helpMessage" :text="helpMessage" /> | 4 | + <BasicHelp :class="`${prefixCls}__help`" v-if="helpMessage" :text="helpMessage" /> |
5 | </span> | 5 | </span> |
6 | </template> | 6 | </template> |
7 | <script lang="ts"> | 7 | <script lang="ts"> |
@@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
11 | 11 | ||
12 | import BasicHelp from './BasicHelp.vue'; | 12 | import BasicHelp from './BasicHelp.vue'; |
13 | import { propTypes } from '/@/utils/propTypes'; | 13 | import { propTypes } from '/@/utils/propTypes'; |
14 | + import { useDesign } from '/@/hooks/web/useDesign'; | ||
14 | 15 | ||
15 | export default defineComponent({ | 16 | export default defineComponent({ |
16 | name: 'BasicTitle', | 17 | name: 'BasicTitle', |
@@ -22,12 +23,17 @@ | @@ -22,12 +23,17 @@ | ||
22 | }, | 23 | }, |
23 | span: propTypes.bool, | 24 | span: propTypes.bool, |
24 | }, | 25 | }, |
26 | + setup() { | ||
27 | + const { prefixCls } = useDesign('basic-title'); | ||
28 | + return { prefixCls }; | ||
29 | + }, | ||
25 | }); | 30 | }); |
26 | </script> | 31 | </script> |
27 | <style lang="less" scoped> | 32 | <style lang="less" scoped> |
28 | @import (reference) '../../../design/index.less'; | 33 | @import (reference) '../../../design/index.less'; |
34 | + @prefix-cls: ~'@{namespace}-basic-title'; | ||
29 | 35 | ||
30 | - .base-title { | 36 | + .@{prefix-cls} { |
31 | position: relative; | 37 | position: relative; |
32 | display: flex; | 38 | display: flex; |
33 | padding-left: 7px; | 39 | padding-left: 7px; |
src/components/ClickOutSide/src/index.vue
1 | <template> | 1 | <template> |
2 | - <div ref="wrapRef"><slot /></div> | 2 | + <div ref="wrap"><slot /></div> |
3 | </template> | 3 | </template> |
4 | <script lang="ts"> | 4 | <script lang="ts"> |
5 | import type { Ref } from 'vue'; | 5 | import type { Ref } from 'vue'; |
@@ -10,13 +10,13 @@ | @@ -10,13 +10,13 @@ | ||
10 | export default defineComponent({ | 10 | export default defineComponent({ |
11 | name: 'ClickOutSide', | 11 | name: 'ClickOutSide', |
12 | setup(_, { emit }) { | 12 | setup(_, { emit }) { |
13 | - const wrapRef = ref<ElRef>(null); | 13 | + const wrap = ref<ElRef>(null); |
14 | 14 | ||
15 | - useClickOutside(wrapRef as Ref<HTMLDivElement>, () => { | 15 | + useClickOutside(wrap as Ref<HTMLDivElement>, () => { |
16 | emit('clickOutside'); | 16 | emit('clickOutside'); |
17 | }); | 17 | }); |
18 | 18 | ||
19 | - return { wrapRef }; | 19 | + return { wrap }; |
20 | }, | 20 | }, |
21 | }); | 21 | }); |
22 | </script> | 22 | </script> |
src/layouts/default/multitabs/index.tsx
@@ -16,6 +16,7 @@ import { tabStore } from '/@/store/modules/tab'; | @@ -16,6 +16,7 @@ import { tabStore } from '/@/store/modules/tab'; | ||
16 | import { userStore } from '/@/store/modules/user'; | 16 | import { userStore } from '/@/store/modules/user'; |
17 | 17 | ||
18 | import { initAffixTabs, useTabsDrag } from './useMultipleTabs'; | 18 | import { initAffixTabs, useTabsDrag } from './useMultipleTabs'; |
19 | +import { REDIRECT_NAME } from '/@/router/constant'; | ||
19 | 20 | ||
20 | export default defineComponent({ | 21 | export default defineComponent({ |
21 | name: 'MultipleTabs', | 22 | name: 'MultipleTabs', |
@@ -35,6 +36,9 @@ export default defineComponent({ | @@ -35,6 +36,9 @@ export default defineComponent({ | ||
35 | watch( | 36 | watch( |
36 | () => tabStore.getLastChangeRouteState?.path, | 37 | () => tabStore.getLastChangeRouteState?.path, |
37 | () => { | 38 | () => { |
39 | + if (tabStore.getLastChangeRouteState?.name === REDIRECT_NAME) { | ||
40 | + return; | ||
41 | + } | ||
38 | const lastChangeRoute = unref(tabStore.getLastChangeRouteState); | 42 | const lastChangeRoute = unref(tabStore.getLastChangeRouteState); |
39 | if (!lastChangeRoute || !userStore.getTokenState) return; | 43 | if (!lastChangeRoute || !userStore.getTokenState) return; |
40 | const { path, fullPath } = lastChangeRoute; | 44 | const { path, fullPath } = lastChangeRoute; |