Commit 34a80542de670f0385dffaf5bf64bb9c3f6b90da
1 parent
c5f2577f
fix: fix darkModeSwitch switch failure
Showing
6 changed files
with
48 additions
and
78 deletions
src/components/Application/src/AppDarkModeToggle.vue
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | </div> |
7 | 7 | </template> |
8 | 8 | <script lang="ts"> |
9 | - import { defineComponent, computed } from 'vue'; | |
9 | + import { defineComponent, computed, unref } from 'vue'; | |
10 | 10 | import { SvgIcon } from '/@/components/Icon'; |
11 | 11 | import { useDesign } from '/@/hooks/web/useDesign'; |
12 | 12 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | const getClass = computed(() => [ |
27 | 27 | prefixCls, |
28 | 28 | { |
29 | - [`${prefixCls}--dark`]: isDark, | |
29 | + [`${prefixCls}--dark`]: unref(isDark), | |
30 | 30 | }, |
31 | 31 | ]); |
32 | 32 | |
... | ... |
src/components/CountDown/index.ts
1 | -import CountButton from './src/CountButton.vue'; | |
2 | -import CountdownInput from './src/CountdownInput.vue'; | |
1 | +import { withInstall } from '/@/utils'; | |
2 | +import countButton from './src/CountButton.vue'; | |
3 | +import countdownInput from './src/CountdownInput.vue'; | |
3 | 4 | |
4 | -export { CountdownInput, CountButton }; | |
5 | +export const CountdownInput = withInstall(countdownInput); | |
6 | +export const CountButton = withInstall(countButton); | |
... | ... |
src/components/CountDown/src/CountButton.vue
1 | 1 | <template> |
2 | 2 | <Button v-bind="$attrs" :disabled="isStart" @click="handleStart" :loading="loading"> |
3 | - {{ | |
4 | - !isStart | |
5 | - ? t('component.countdown.normalText') | |
6 | - : t('component.countdown.sendText', [currentCount]) | |
7 | - }} | |
3 | + {{ getButtonText }} | |
8 | 4 | </Button> |
9 | 5 | </template> |
10 | 6 | <script lang="ts"> |
11 | - import { defineComponent, ref, PropType, watchEffect } from 'vue'; | |
12 | - | |
7 | + import { defineComponent, ref, watchEffect, computed, unref } from 'vue'; | |
13 | 8 | import { Button } from 'ant-design-vue'; |
14 | - | |
15 | 9 | import { useCountdown } from './useCountdown'; |
16 | 10 | import { isFunction } from '/@/utils/is'; |
17 | 11 | import { useI18n } from '/@/hooks/web/useI18n'; |
18 | - import { propTypes } from '/@/utils/propTypes'; | |
12 | + | |
13 | + const props = { | |
14 | + value: { type: [Object, Number, String, Array] }, | |
15 | + count: { type: Number, default: 60 }, | |
16 | + beforeStartFunc: { | |
17 | + type: Function as PropType<() => Promise<boolean>>, | |
18 | + default: null, | |
19 | + }, | |
20 | + }; | |
19 | 21 | |
20 | 22 | export default defineComponent({ |
21 | 23 | name: 'CountButton', |
22 | 24 | components: { Button }, |
23 | - props: { | |
24 | - value: propTypes.any, | |
25 | - count: propTypes.number.def(60), | |
26 | - beforeStartFunc: { | |
27 | - type: Function as PropType<() => boolean>, | |
28 | - default: null, | |
29 | - }, | |
30 | - }, | |
25 | + props, | |
31 | 26 | setup(props) { |
32 | 27 | const loading = ref(false); |
33 | 28 | |
34 | 29 | const { currentCount, isStart, start, reset } = useCountdown(props.count); |
35 | 30 | const { t } = useI18n(); |
36 | 31 | |
32 | + const getButtonText = computed(() => { | |
33 | + return !unref(isStart) | |
34 | + ? t('component.countdown.normalText') | |
35 | + : t('component.countdown.sendText', [unref(currentCount)]); | |
36 | + }); | |
37 | + | |
37 | 38 | watchEffect(() => { |
38 | 39 | props.value === undefined && reset(); |
39 | 40 | }); |
41 | + | |
40 | 42 | /** |
41 | 43 | * @description: Judge whether there is an external function before execution, and decide whether to start after execution |
42 | 44 | */ |
... | ... | @@ -54,7 +56,7 @@ |
54 | 56 | start(); |
55 | 57 | } |
56 | 58 | } |
57 | - return { handleStart, isStart, currentCount, loading, t }; | |
59 | + return { handleStart, currentCount, loading, getButtonText, isStart }; | |
58 | 60 | }, |
59 | 61 | }); |
60 | 62 | </script> |
... | ... |
src/components/CountDown/src/CountdownInput.vue
... | ... | @@ -7,31 +7,30 @@ |
7 | 7 | </template> |
8 | 8 | <script lang="ts"> |
9 | 9 | import { defineComponent, PropType } from 'vue'; |
10 | - | |
11 | 10 | import { Input } from 'ant-design-vue'; |
12 | 11 | import CountButton from './CountButton.vue'; |
13 | - | |
14 | - import { propTypes } from '/@/utils/propTypes'; | |
15 | 12 | import { useDesign } from '/@/hooks/web/useDesign'; |
16 | - | |
17 | 13 | import { useRuleFormItem } from '/@/hooks/component/useFormItem'; |
18 | 14 | |
15 | + const props = { | |
16 | + value: { type: String }, | |
17 | + size: { type: String, validator: (v) => ['default', 'large', 'small'].includes(v) }, | |
18 | + count: { type: Number, default: 60 }, | |
19 | + sendCodeApi: { | |
20 | + type: Function as PropType<() => Promise<boolean>>, | |
21 | + default: null, | |
22 | + }, | |
23 | + }; | |
24 | + | |
19 | 25 | export default defineComponent({ |
20 | 26 | name: 'CountDownInput', |
21 | 27 | components: { [Input.name]: Input, CountButton }, |
22 | 28 | inheritAttrs: false, |
23 | - props: { | |
24 | - value: propTypes.string, | |
25 | - size: propTypes.oneOf(['default', 'large', 'small']), | |
26 | - count: propTypes.number.def(60), | |
27 | - sendCodeApi: { | |
28 | - type: Function as PropType<() => boolean>, | |
29 | - default: null, | |
30 | - }, | |
31 | - }, | |
29 | + props, | |
32 | 30 | setup(props) { |
33 | 31 | const { prefixCls } = useDesign('countdown-input'); |
34 | 32 | const [state] = useRuleFormItem(props); |
33 | + | |
35 | 34 | return { prefixCls, state }; |
36 | 35 | }, |
37 | 36 | }); |
... | ... |
src/components/registerGlobComp.ts
1 | -import Icon from './Icon/index'; | |
1 | +import { Icon } from './Icon'; | |
2 | 2 | import { Button } from './Button'; |
3 | 3 | import { |
4 | 4 | // Need |
5 | 5 | Button as AntButton, |
6 | + Input, | |
6 | 7 | } from 'ant-design-vue'; |
7 | 8 | |
8 | 9 | import { App } from 'vue'; |
9 | 10 | |
10 | -const compList = [Icon, Button, AntButton.Group]; | |
11 | +const compList = [Icon, AntButton.Group]; | |
11 | 12 | |
12 | 13 | export function registerGlobComp(app: App) { |
13 | 14 | compList.forEach((comp: any) => { |
14 | 15 | app.component(comp.name || comp.displayName, comp); |
15 | 16 | }); |
17 | + | |
18 | + app.use(Input).use(Button); | |
16 | 19 | } |
... | ... |
src/views/dashboard/analysis/components/VisitAnalysis.vue
... | ... | @@ -80,26 +80,8 @@ |
80 | 80 | { |
81 | 81 | smooth: true, |
82 | 82 | data: [ |
83 | - 111, | |
84 | - 222, | |
85 | - 4000, | |
86 | - 18000, | |
87 | - 33333, | |
88 | - 55555, | |
89 | - 66666, | |
90 | - 33333, | |
91 | - 14000, | |
92 | - 36000, | |
93 | - 66666, | |
94 | - 44444, | |
95 | - 22222, | |
96 | - 11111, | |
97 | - 4000, | |
98 | - 2000, | |
99 | - 500, | |
100 | - 333, | |
101 | - 222, | |
102 | - 111, | |
83 | + 111, 222, 4000, 18000, 33333, 55555, 66666, 33333, 14000, 36000, 66666, 44444, | |
84 | + 22222, 11111, 4000, 2000, 500, 333, 222, 111, | |
103 | 85 | ], |
104 | 86 | type: 'line', |
105 | 87 | areaStyle: {}, |
... | ... | @@ -110,26 +92,8 @@ |
110 | 92 | { |
111 | 93 | smooth: true, |
112 | 94 | data: [ |
113 | - 33, | |
114 | - 66, | |
115 | - 88, | |
116 | - 333, | |
117 | - 3333, | |
118 | - 5000, | |
119 | - 18000, | |
120 | - 3000, | |
121 | - 1200, | |
122 | - 13000, | |
123 | - 22000, | |
124 | - 11000, | |
125 | - 2221, | |
126 | - 1201, | |
127 | - 390, | |
128 | - 198, | |
129 | - 60, | |
130 | - 30, | |
131 | - 22, | |
132 | - 11, | |
95 | + 33, 66, 88, 333, 3333, 5000, 18000, 3000, 1200, 13000, 22000, 11000, 2221, 1201, | |
96 | + 390, 198, 60, 30, 22, 11, | |
133 | 97 | ], |
134 | 98 | type: 'line', |
135 | 99 | areaStyle: {}, |
... | ... |