1
1
<template >
2
2
<div >
3
3
<a-card class =" card" >
4
+ <full-loading :show =" loading" :text =" loadingText" />
4
5
<p >全局组件测试</p >
5
6
<a-row >
6
- <a-col :span =" 12" > <a-button @click =" openFullLoading" >全局加载 3 秒</a-button > </a-col >
7
- <a-col :span =" 12" > <a-button @click =" openFullLoading " >局部加载 </a-button > </a-col >
7
+ <a-col :span =" 12" > <a-button type = " primary " @click =" openFullLoading" >全局加载 3 秒</a-button > </a-col >
8
+ <a-col :span =" 12" > <a-button @click =" openPartLoading " >局部加载 </a-button > </a-col >
8
9
</a-row >
9
10
</a-card >
10
11
11
12
<a-card class =" card" >
12
13
<p >vuex测试</p >
14
+ <a-row >
15
+ <a-col :span =" 12" >
16
+ <p >app模块</p >
17
+ <p >
18
+ <a-tag v-for =" (item, key, index) of app" :key =" index" color =" pink" >{{ `${key}:${item}` }}</a-tag >
19
+ </p >
20
+
21
+ <a-form :label-col =" labelCol" :wrapper-col =" wrapperCol" >
22
+ <a-form-item label =" 更改主题名" >
23
+ <a-row >
24
+ <a-col :span =" 18" >
25
+ <a-input v-model:value =" inputValue" />
26
+ </a-col >
27
+ <a-col :span =" 6" >
28
+ <a-button type =" success" @click =" changeTheme" >确认</a-button >
29
+ </a-col >
30
+ </a-row >
31
+ </a-form-item >
32
+ </a-form >
33
+ </a-col >
34
+ <a-col :span =" 12" >
35
+ <p >根模块</p >
36
+ <p >
37
+ <a-tag color =" pink" >{{ `loadingText:${loadingText}` }}</a-tag >
38
+ </p >
39
+ <a-form :label-col =" { span: 6 }" :wrapper-col =" wrapperCol" >
40
+ <a-form-item label =" 全局加载文字" >
41
+ <a-row >
42
+ <a-col :span =" 16" >
43
+ <a-input v-model:value =" globalLoadingText" />
44
+ </a-col >
45
+ <a-col offset =" 2" :span =" 6" >
46
+ <a-button type =" success" @click =" changeText" >更改并打开</a-button >
47
+ </a-col >
48
+ </a-row >
49
+ </a-form-item >
50
+ </a-form >
51
+ </a-col >
52
+ </a-row >
13
53
</a-card >
14
54
</div >
15
55
</template >
18
58
import { defineComponent } from ' vue'
19
59
20
60
export default defineComponent ({
61
+ data () {
62
+ return {
63
+ labelCol: { span: 4 },
64
+ wrapperCol: { span: 14 },
65
+ loading: false ,
66
+ inputValue: ' ' ,
67
+ globalLoadingText: ' '
68
+ }
69
+ },
70
+ created () {
71
+ console .log (this .app )
72
+ },
73
+ computed: {
74
+ app () {
75
+ return this .$store .state .app
76
+ },
77
+ loadingText () {
78
+ return this .$store .state .loadingText
79
+ }
80
+ },
21
81
methods: {
82
+ /**
83
+ * @description 更改 vuex 主题名
84
+ */
85
+ changeTheme () {
86
+ console .log (this .inputValue )
87
+ this .$store .__s (' app.theme' , this .inputValue )
88
+ },
89
+ changeText () {
90
+ this .$store .__s (' loadingText' , this .globalLoadingText )
91
+ this .$store .__s (' fullLoading' , true )
92
+ setTimeout (() => {
93
+ this .$store .__s (' fullLoading' , false )
94
+ }, 3000 )
95
+ },
96
+ openPartLoading () {
97
+ this .loading = true
98
+ setTimeout (() => {
99
+ this .loading = false
100
+ }, 3000 )
101
+ },
22
102
openFullLoading () {
103
+ this .$store .__s (' loadingText' , ' 全局加载中' )
23
104
this .$store .__s (' fullLoading' , true )
24
105
setTimeout (() => {
25
106
this .$store .__s (' fullLoading' , false )
@@ -32,5 +113,6 @@ export default defineComponent({
32
113
<style lang="less" scoped>
33
114
.card {
34
115
margin-top : 30px ;
116
+ position : relative ;
35
117
}
36
118
</style >
0 commit comments