Skip to content

Commit 34a8054

Browse files
committed
fix: fix darkModeSwitch switch failure
1 parent c5f2577 commit 34a8054

File tree

6 files changed

+48
-78
lines changed

6 files changed

+48
-78
lines changed

src/components/Application/src/AppDarkModeToggle.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</div>
77
</template>
88
<script lang="ts">
9-
import { defineComponent, computed } from 'vue';
9+
import { defineComponent, computed, unref } from 'vue';
1010
import { SvgIcon } from '/@/components/Icon';
1111
import { useDesign } from '/@/hooks/web/useDesign';
1212
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
@@ -26,7 +26,7 @@
2626
const getClass = computed(() => [
2727
prefixCls,
2828
{
29-
[`${prefixCls}--dark`]: isDark,
29+
[`${prefixCls}--dark`]: unref(isDark),
3030
},
3131
]);
3232

src/components/CountDown/index.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
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';
34

4-
export { CountdownInput, CountButton };
5+
export const CountdownInput = withInstall(countdownInput);
6+
export const CountButton = withInstall(countButton);
+20-18
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,44 @@
11
<template>
22
<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 }}
84
</Button>
95
</template>
106
<script lang="ts">
11-
import { defineComponent, ref, PropType, watchEffect } from 'vue';
12-
7+
import { defineComponent, ref, watchEffect, computed, unref } from 'vue';
138
import { Button } from 'ant-design-vue';
14-
159
import { useCountdown } from './useCountdown';
1610
import { isFunction } from '/@/utils/is';
1711
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+
};
1921
2022
export default defineComponent({
2123
name: 'CountButton',
2224
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,
3126
setup(props) {
3227
const loading = ref(false);
3328
3429
const { currentCount, isStart, start, reset } = useCountdown(props.count);
3530
const { t } = useI18n();
3631
32+
const getButtonText = computed(() => {
33+
return !unref(isStart)
34+
? t('component.countdown.normalText')
35+
: t('component.countdown.sendText', [unref(currentCount)]);
36+
});
37+
3738
watchEffect(() => {
3839
props.value === undefined && reset();
3940
});
41+
4042
/**
4143
* @description: Judge whether there is an external function before execution, and decide whether to start after execution
4244
*/
@@ -54,7 +56,7 @@
5456
start();
5557
}
5658
}
57-
return { handleStart, isStart, currentCount, loading, t };
59+
return { handleStart, currentCount, loading, getButtonText, isStart };
5860
},
5961
});
6062
</script>

src/components/CountDown/src/CountdownInput.vue

+12-13
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,30 @@
77
</template>
88
<script lang="ts">
99
import { defineComponent, PropType } from 'vue';
10-
1110
import { Input } from 'ant-design-vue';
1211
import CountButton from './CountButton.vue';
13-
14-
import { propTypes } from '/@/utils/propTypes';
1512
import { useDesign } from '/@/hooks/web/useDesign';
16-
1713
import { useRuleFormItem } from '/@/hooks/component/useFormItem';
1814
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+
1925
export default defineComponent({
2026
name: 'CountDownInput',
2127
components: { [Input.name]: Input, CountButton },
2228
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,
3230
setup(props) {
3331
const { prefixCls } = useDesign('countdown-input');
3432
const [state] = useRuleFormItem(props);
33+
3534
return { prefixCls, state };
3635
},
3736
});

src/components/registerGlobComp.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import Icon from './Icon/index';
1+
import { Icon } from './Icon';
22
import { Button } from './Button';
33
import {
44
// Need
55
Button as AntButton,
6+
Input,
67
} from 'ant-design-vue';
78

89
import { App } from 'vue';
910

10-
const compList = [Icon, Button, AntButton.Group];
11+
const compList = [Icon, AntButton.Group];
1112

1213
export function registerGlobComp(app: App) {
1314
compList.forEach((comp: any) => {
1415
app.component(comp.name || comp.displayName, comp);
1516
});
17+
18+
app.use(Input).use(Button);
1619
}

src/views/dashboard/analysis/components/VisitAnalysis.vue

+4-40
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,8 @@
8080
{
8181
smooth: true,
8282
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,
10385
],
10486
type: 'line',
10587
areaStyle: {},
@@ -110,26 +92,8 @@
11092
{
11193
smooth: true,
11294
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,
13397
],
13498
type: 'line',
13599
areaStyle: {},

0 commit comments

Comments
 (0)