ct-component-plus 0.0.43 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +36 -36
- package/packages/components/button/index.js +8 -8
- package/packages/components/button/src/button.vue +171 -171
- package/packages/components/cascader/index.js +7 -7
- package/packages/components/cascader/src/cascader.vue +247 -247
- package/packages/components/cascader/src/ct-cascader.vue +260 -260
- package/packages/components/cascader/src/index.js +50 -50
- package/packages/components/checkbox/index.js +7 -7
- package/packages/components/checkbox/src/checkbox.vue +51 -51
- package/packages/components/checkbox/src/index.js +12 -12
- package/packages/components/date-picker/index.js +8 -8
- package/packages/components/date-picker/src/clear-icon.vue +2 -2
- package/packages/components/date-picker/src/date-icon.vue +2 -2
- package/packages/components/date-picker/src/date-picker.vue +77 -77
- package/packages/components/date-picker/src/index.js +33 -33
- package/packages/components/dialog/index.js +8 -8
- package/packages/components/dialog/src/dialog.vue +103 -103
- package/packages/components/empty/index.js +8 -8
- package/packages/components/empty/src/empty.vue +97 -97
- package/packages/components/index.js +81 -81
- package/packages/components/input/index.js +7 -7
- package/packages/components/input/src/index.js +13 -13
- package/packages/components/input/src/input.vue +106 -106
- package/packages/components/input-range/index.js +7 -7
- package/packages/components/input-range/src/index.js +29 -29
- package/packages/components/input-range/src/input-range.vue +233 -233
- package/packages/components/loading/index.js +7 -7
- package/packages/components/loading/src/CtLoading.vue +74 -74
- package/packages/components/loading/src/beating.vue +71 -71
- package/packages/components/loading/src/progress.vue +120 -120
- package/packages/components/loading/src/spinner.vue +38 -38
- package/packages/components/menu/index.js +7 -7
- package/packages/components/menu/src/item.vue +46 -46
- package/packages/components/menu/src/link.vue +28 -28
- package/packages/components/menu/src/logo.vue +25 -25
- package/packages/components/menu/src/menu-item.vue +103 -103
- package/packages/components/menu/src/menu.vue +191 -191
- package/packages/components/menu/src/utils/index.js +4 -4
- package/packages/components/message/icon/ErrorIcon.vue +25 -25
- package/packages/components/message/icon/InfoIcon.vue +25 -25
- package/packages/components/message/icon/SuccessIcon.vue +25 -25
- package/packages/components/message/icon/WarningIcon.vue +25 -25
- package/packages/components/message/index.js +8 -8
- package/packages/components/message/src/method.js +54 -54
- package/packages/components/message-box/index.js +7 -7
- package/packages/components/message-box/src/message-box.vue +107 -107
- package/packages/components/page/index.js +7 -7
- package/packages/components/page/src/modules/DownloadButton.vue +21 -21
- package/packages/components/page/src/modules/TableTitle.vue +151 -151
- package/packages/components/page/src/page.vue +382 -382
- package/packages/components/pagination/index.js +7 -7
- package/packages/components/pagination/src/pagination.vue +36 -36
- package/packages/components/radio/index.js +7 -7
- package/packages/components/radio/src/index.js +12 -12
- package/packages/components/radio/src/radio.vue +47 -47
- package/packages/components/search-box/index.js +24 -24
- package/packages/components/search-box/src/index.js +29 -29
- package/packages/components/search-box/src/search-box.vue +250 -250
- package/packages/components/search-box/src/slot.vue +4 -4
- package/packages/components/select/index.js +7 -7
- package/packages/components/select/src/arrow-down.vue +2 -2
- package/packages/components/select/src/clear-icon.vue +2 -2
- package/packages/components/select/src/empty.vue +13 -13
- package/packages/components/select/src/index.js +51 -51
- package/packages/components/select/src/select.vue +380 -380
- package/packages/components/table/index.js +7 -7
- package/packages/components/table/src/TableSort.vue +179 -179
- package/packages/components/table/src/index.js +78 -70
- package/packages/components/table/src/table.vue +288 -287
- package/packages/components/tabs/index.js +7 -7
- package/packages/components/tabs/src/tabs.vue +225 -225
- package/packages/components/year-select/index.js +7 -7
- package/packages/components/year-select/src/index.js +44 -44
- package/packages/components/year-select/src/year-select.vue +273 -273
- package/packages/constants/aria.ts +17 -17
- package/packages/constants/index.ts +1 -1
- package/packages/directives/click-outside/index.ts +118 -118
- package/packages/echarts/bar/index.js +63 -63
- package/packages/echarts/base.js +99 -99
- package/packages/echarts/line/index.js +106 -106
- package/packages/hooks/index.js +5 -5
- package/packages/hooks/use-buried/index.js +46 -46
- package/packages/hooks/use-checked-all/index.js +37 -37
- package/packages/hooks/use-echarts/index.js +1 -1
- package/packages/hooks/use-echarts/use-bar/index.js +72 -72
- package/packages/hooks/use-echarts/use-line/index.js +88 -88
- package/packages/hooks/use-namespace/index.js +65 -65
- package/packages/hooks/use-search-component/index.js +28 -28
- package/packages/style/element.less +725 -725
- package/packages/style/index.js +2 -2
- package/packages/style/init.less +114 -114
- package/packages/utils/index.js +1 -1
- package/packages/utils/operate.js +77 -77
- package/packages/utils/table.js +135 -0
- package/packages/utils/types.js +35 -35
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ct-loading">
|
|
3
|
-
<div class="ct-loading__main" v-show="showLoad">
|
|
4
|
-
<component :is="componentMap[type]" :is-load="isLoad"></component>
|
|
5
|
-
</div>
|
|
6
|
-
<!-- 默认插槽,放置显示内容 -->
|
|
7
|
-
<div v-show="!showLoad" class="slot-content">
|
|
8
|
-
<slot> </slot>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import beating from "./beating.vue";
|
|
15
|
-
import spinner from "./spinner.vue";
|
|
16
|
-
import CircleProgress from "./progress.vue";
|
|
17
|
-
export default {
|
|
18
|
-
props: {
|
|
19
|
-
type: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: "beating", //beating,spinner,progress
|
|
22
|
-
},
|
|
23
|
-
isLoad: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
},
|
|
26
|
-
delay: {
|
|
27
|
-
type: [String, Number],
|
|
28
|
-
default: 500,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
components: {
|
|
32
|
-
beating,
|
|
33
|
-
spinner,
|
|
34
|
-
CircleProgress,
|
|
35
|
-
},
|
|
36
|
-
data() {
|
|
37
|
-
return {
|
|
38
|
-
showLoad: false,
|
|
39
|
-
componentMap: {
|
|
40
|
-
beating: "beating",
|
|
41
|
-
spinner: "spinner",
|
|
42
|
-
progress: "CircleProgress",
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
created() {},
|
|
47
|
-
mounted() {},
|
|
48
|
-
methods: {},
|
|
49
|
-
watch: {
|
|
50
|
-
isLoad: {
|
|
51
|
-
handler(val) {
|
|
52
|
-
if (val) {
|
|
53
|
-
this.showLoad = val;
|
|
54
|
-
} else {
|
|
55
|
-
if (this.type == "progress") {
|
|
56
|
-
setTimeout(() => {
|
|
57
|
-
this.showLoad = val;
|
|
58
|
-
}, Number(this.delay));
|
|
59
|
-
} else {
|
|
60
|
-
this.showLoad = val;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
immediate: true,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
</script>
|
|
69
|
-
<style scoped lang='less'>
|
|
70
|
-
.ct-loading {
|
|
71
|
-
width: 100%;
|
|
72
|
-
min-height: 200px;
|
|
73
|
-
position: relative;
|
|
74
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ct-loading">
|
|
3
|
+
<div class="ct-loading__main" v-show="showLoad">
|
|
4
|
+
<component :is="componentMap[type]" :is-load="isLoad"></component>
|
|
5
|
+
</div>
|
|
6
|
+
<!-- 默认插槽,放置显示内容 -->
|
|
7
|
+
<div v-show="!showLoad" class="slot-content">
|
|
8
|
+
<slot> </slot>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import beating from "./beating.vue";
|
|
15
|
+
import spinner from "./spinner.vue";
|
|
16
|
+
import CircleProgress from "./progress.vue";
|
|
17
|
+
export default {
|
|
18
|
+
props: {
|
|
19
|
+
type: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "beating", //beating,spinner,progress
|
|
22
|
+
},
|
|
23
|
+
isLoad: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
},
|
|
26
|
+
delay: {
|
|
27
|
+
type: [String, Number],
|
|
28
|
+
default: 500,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
components: {
|
|
32
|
+
beating,
|
|
33
|
+
spinner,
|
|
34
|
+
CircleProgress,
|
|
35
|
+
},
|
|
36
|
+
data() {
|
|
37
|
+
return {
|
|
38
|
+
showLoad: false,
|
|
39
|
+
componentMap: {
|
|
40
|
+
beating: "beating",
|
|
41
|
+
spinner: "spinner",
|
|
42
|
+
progress: "CircleProgress",
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
created() {},
|
|
47
|
+
mounted() {},
|
|
48
|
+
methods: {},
|
|
49
|
+
watch: {
|
|
50
|
+
isLoad: {
|
|
51
|
+
handler(val) {
|
|
52
|
+
if (val) {
|
|
53
|
+
this.showLoad = val;
|
|
54
|
+
} else {
|
|
55
|
+
if (this.type == "progress") {
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
this.showLoad = val;
|
|
58
|
+
}, Number(this.delay));
|
|
59
|
+
} else {
|
|
60
|
+
this.showLoad = val;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
immediate: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
69
|
+
<style scoped lang='less'>
|
|
70
|
+
.ct-loading {
|
|
71
|
+
width: 100%;
|
|
72
|
+
min-height: 200px;
|
|
73
|
+
position: relative;
|
|
74
|
+
}
|
|
75
75
|
</style>
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 跳动加载特效 -->
|
|
3
|
-
<div class="ct-loading__beating">
|
|
4
|
-
<div></div>
|
|
5
|
-
<div></div>
|
|
6
|
-
<div></div>
|
|
7
|
-
<div></div>
|
|
8
|
-
<div></div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
<script>
|
|
12
|
-
export default {};
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<style lang="less" scoped>
|
|
16
|
-
.ct-loading__beating {
|
|
17
|
-
width: 40px;
|
|
18
|
-
height: 45px;
|
|
19
|
-
text-align: center;
|
|
20
|
-
font-size: 10px;
|
|
21
|
-
position: absolute;
|
|
22
|
-
left: 50%;
|
|
23
|
-
top: 50%;
|
|
24
|
-
transform: translate(-50%, -50%);
|
|
25
|
-
border-radius: 10px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ct-loading__beating > div {
|
|
29
|
-
background-color: var(--ct-color-primary, #2e65fd);
|
|
30
|
-
opacity: 0.8;
|
|
31
|
-
height: 100%;
|
|
32
|
-
width: 4px;
|
|
33
|
-
border-radius: 10px;
|
|
34
|
-
display: inline-block;
|
|
35
|
-
margin: 0 2px;
|
|
36
|
-
-webkit-animation: stretchdelay 1.2s infinite ease-in-out;
|
|
37
|
-
animation: stretchdelay 1.2s infinite ease-in-out;
|
|
38
|
-
|
|
39
|
-
&:nth-child(2) {
|
|
40
|
-
-webkit-animation-delay: -1.1s;
|
|
41
|
-
animation-delay: -1.1s;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&:nth-child(3) {
|
|
45
|
-
-webkit-animation-delay: -1s;
|
|
46
|
-
animation-delay: -1s;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&:nth-child(4) {
|
|
50
|
-
-webkit-animation-delay: -0.9s;
|
|
51
|
-
animation-delay: -0.9s;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&:nth-child(5) {
|
|
55
|
-
-webkit-animation-delay: -0.8s;
|
|
56
|
-
animation-delay: -0.8s;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
@keyframes stretchdelay {
|
|
60
|
-
0%,
|
|
61
|
-
40%,
|
|
62
|
-
100% {
|
|
63
|
-
transform: scaleY(0.4);
|
|
64
|
-
-webkit-transform: scaleY(0.4);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
20% {
|
|
68
|
-
transform: scaleY(1);
|
|
69
|
-
-webkit-transform: scaleY(1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 跳动加载特效 -->
|
|
3
|
+
<div class="ct-loading__beating">
|
|
4
|
+
<div></div>
|
|
5
|
+
<div></div>
|
|
6
|
+
<div></div>
|
|
7
|
+
<div></div>
|
|
8
|
+
<div></div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
export default {};
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<style lang="less" scoped>
|
|
16
|
+
.ct-loading__beating {
|
|
17
|
+
width: 40px;
|
|
18
|
+
height: 45px;
|
|
19
|
+
text-align: center;
|
|
20
|
+
font-size: 10px;
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: 50%;
|
|
23
|
+
top: 50%;
|
|
24
|
+
transform: translate(-50%, -50%);
|
|
25
|
+
border-radius: 10px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ct-loading__beating > div {
|
|
29
|
+
background-color: var(--ct-color-primary, #2e65fd);
|
|
30
|
+
opacity: 0.8;
|
|
31
|
+
height: 100%;
|
|
32
|
+
width: 4px;
|
|
33
|
+
border-radius: 10px;
|
|
34
|
+
display: inline-block;
|
|
35
|
+
margin: 0 2px;
|
|
36
|
+
-webkit-animation: stretchdelay 1.2s infinite ease-in-out;
|
|
37
|
+
animation: stretchdelay 1.2s infinite ease-in-out;
|
|
38
|
+
|
|
39
|
+
&:nth-child(2) {
|
|
40
|
+
-webkit-animation-delay: -1.1s;
|
|
41
|
+
animation-delay: -1.1s;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:nth-child(3) {
|
|
45
|
+
-webkit-animation-delay: -1s;
|
|
46
|
+
animation-delay: -1s;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:nth-child(4) {
|
|
50
|
+
-webkit-animation-delay: -0.9s;
|
|
51
|
+
animation-delay: -0.9s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:nth-child(5) {
|
|
55
|
+
-webkit-animation-delay: -0.8s;
|
|
56
|
+
animation-delay: -0.8s;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
@keyframes stretchdelay {
|
|
60
|
+
0%,
|
|
61
|
+
40%,
|
|
62
|
+
100% {
|
|
63
|
+
transform: scaleY(0.4);
|
|
64
|
+
-webkit-transform: scaleY(0.4);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
20% {
|
|
68
|
+
transform: scaleY(1);
|
|
69
|
+
-webkit-transform: scaleY(1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
72
|
</style>
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg class="ct-loading__progress" width="100" height="100">
|
|
3
|
-
<circle
|
|
4
|
-
cx="50"
|
|
5
|
-
cy="50"
|
|
6
|
-
r="45"
|
|
7
|
-
stroke="#F5F7FA"
|
|
8
|
-
stroke-width="6"
|
|
9
|
-
fill="none"
|
|
10
|
-
></circle>
|
|
11
|
-
<circle
|
|
12
|
-
cx="50"
|
|
13
|
-
cy="50"
|
|
14
|
-
r="45"
|
|
15
|
-
:stroke="color"
|
|
16
|
-
class="circle"
|
|
17
|
-
id="ct-loading__progress"
|
|
18
|
-
></circle>
|
|
19
|
-
<text x="50" y="55" fill="#141617" text-anchor="middle">
|
|
20
|
-
<tspan class="text">{{ currentPercentage }}</tspan>
|
|
21
|
-
<tspan class="percent">%</tspan>
|
|
22
|
-
</text>
|
|
23
|
-
</svg>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
export default {
|
|
28
|
-
name: "CircleProgress",
|
|
29
|
-
props: {
|
|
30
|
-
color: {
|
|
31
|
-
default: "#2E65FD",
|
|
32
|
-
},
|
|
33
|
-
isLoad: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
data() {
|
|
38
|
-
return {
|
|
39
|
-
currentPercentage: 0,
|
|
40
|
-
progressLen: 282.6,
|
|
41
|
-
circleDom: null,
|
|
42
|
-
interval: null,
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
created() {},
|
|
46
|
-
mounted() {
|
|
47
|
-
this.circleDom = document.querySelector("#ct-loading__progress");
|
|
48
|
-
},
|
|
49
|
-
methods: {
|
|
50
|
-
setPercent(dom, num) {
|
|
51
|
-
if (num > 100) return;
|
|
52
|
-
dom.style["stroke-dashoffset"] =
|
|
53
|
-
this.progressLen - (this.progressLen / 100) * num;
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
watch: {
|
|
57
|
-
isLoad: {
|
|
58
|
-
handler(val) {
|
|
59
|
-
if (val) {
|
|
60
|
-
this.currentPercentage = 0;
|
|
61
|
-
this.interval = setInterval(() => {
|
|
62
|
-
if (this.currentPercentage <= 60) {
|
|
63
|
-
this.currentPercentage += Math.floor(Math.random() * 5 + 5);
|
|
64
|
-
} else {
|
|
65
|
-
this.currentPercentage += Math.floor(Math.random() * 5);
|
|
66
|
-
}
|
|
67
|
-
if (this.currentPercentage >= 99) this.currentPercentage = 99;
|
|
68
|
-
}, 250);
|
|
69
|
-
} else {
|
|
70
|
-
this.currentPercentage = 100;
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
immediate: true,
|
|
74
|
-
},
|
|
75
|
-
currentPercentage(val) {
|
|
76
|
-
this.setPercent(this.circleDom, val);
|
|
77
|
-
if (val == 100) {
|
|
78
|
-
clearInterval(this.interval);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
beforeDestroy() {
|
|
83
|
-
clearInterval(this.interval);
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
</script>
|
|
87
|
-
<style scoped lang='less'>
|
|
88
|
-
.ct-loading__progress {
|
|
89
|
-
position: absolute;
|
|
90
|
-
left: 50%;
|
|
91
|
-
top: 50%;
|
|
92
|
-
transform: translate(-50%, -50%);
|
|
93
|
-
.circle {
|
|
94
|
-
fill: none;
|
|
95
|
-
stroke-width: 6;
|
|
96
|
-
stroke-dasharray: 282.6;
|
|
97
|
-
stroke-dashoffset: 282.6;
|
|
98
|
-
//animation: circle 3s infinite;
|
|
99
|
-
stroke-linecap: round;
|
|
100
|
-
transform: rotate(-90deg);
|
|
101
|
-
transform-origin: center;
|
|
102
|
-
transform-box: fill-box;
|
|
103
|
-
transition: all 0.5s;
|
|
104
|
-
}
|
|
105
|
-
@keyframes circle {
|
|
106
|
-
100% {
|
|
107
|
-
stroke-dashoffset: 0;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.text,
|
|
112
|
-
.percent {
|
|
113
|
-
font-weight: 500;
|
|
114
|
-
}
|
|
115
|
-
text {
|
|
116
|
-
display: flex;
|
|
117
|
-
justify-content: center;
|
|
118
|
-
align-items: center;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<svg class="ct-loading__progress" width="100" height="100">
|
|
3
|
+
<circle
|
|
4
|
+
cx="50"
|
|
5
|
+
cy="50"
|
|
6
|
+
r="45"
|
|
7
|
+
stroke="#F5F7FA"
|
|
8
|
+
stroke-width="6"
|
|
9
|
+
fill="none"
|
|
10
|
+
></circle>
|
|
11
|
+
<circle
|
|
12
|
+
cx="50"
|
|
13
|
+
cy="50"
|
|
14
|
+
r="45"
|
|
15
|
+
:stroke="color"
|
|
16
|
+
class="circle"
|
|
17
|
+
id="ct-loading__progress"
|
|
18
|
+
></circle>
|
|
19
|
+
<text x="50" y="55" fill="#141617" text-anchor="middle">
|
|
20
|
+
<tspan class="text">{{ currentPercentage }}</tspan>
|
|
21
|
+
<tspan class="percent">%</tspan>
|
|
22
|
+
</text>
|
|
23
|
+
</svg>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: "CircleProgress",
|
|
29
|
+
props: {
|
|
30
|
+
color: {
|
|
31
|
+
default: "#2E65FD",
|
|
32
|
+
},
|
|
33
|
+
isLoad: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
currentPercentage: 0,
|
|
40
|
+
progressLen: 282.6,
|
|
41
|
+
circleDom: null,
|
|
42
|
+
interval: null,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
created() {},
|
|
46
|
+
mounted() {
|
|
47
|
+
this.circleDom = document.querySelector("#ct-loading__progress");
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
setPercent(dom, num) {
|
|
51
|
+
if (num > 100) return;
|
|
52
|
+
dom.style["stroke-dashoffset"] =
|
|
53
|
+
this.progressLen - (this.progressLen / 100) * num;
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
watch: {
|
|
57
|
+
isLoad: {
|
|
58
|
+
handler(val) {
|
|
59
|
+
if (val) {
|
|
60
|
+
this.currentPercentage = 0;
|
|
61
|
+
this.interval = setInterval(() => {
|
|
62
|
+
if (this.currentPercentage <= 60) {
|
|
63
|
+
this.currentPercentage += Math.floor(Math.random() * 5 + 5);
|
|
64
|
+
} else {
|
|
65
|
+
this.currentPercentage += Math.floor(Math.random() * 5);
|
|
66
|
+
}
|
|
67
|
+
if (this.currentPercentage >= 99) this.currentPercentage = 99;
|
|
68
|
+
}, 250);
|
|
69
|
+
} else {
|
|
70
|
+
this.currentPercentage = 100;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
immediate: true,
|
|
74
|
+
},
|
|
75
|
+
currentPercentage(val) {
|
|
76
|
+
this.setPercent(this.circleDom, val);
|
|
77
|
+
if (val == 100) {
|
|
78
|
+
clearInterval(this.interval);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
beforeDestroy() {
|
|
83
|
+
clearInterval(this.interval);
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
</script>
|
|
87
|
+
<style scoped lang='less'>
|
|
88
|
+
.ct-loading__progress {
|
|
89
|
+
position: absolute;
|
|
90
|
+
left: 50%;
|
|
91
|
+
top: 50%;
|
|
92
|
+
transform: translate(-50%, -50%);
|
|
93
|
+
.circle {
|
|
94
|
+
fill: none;
|
|
95
|
+
stroke-width: 6;
|
|
96
|
+
stroke-dasharray: 282.6;
|
|
97
|
+
stroke-dashoffset: 282.6;
|
|
98
|
+
//animation: circle 3s infinite;
|
|
99
|
+
stroke-linecap: round;
|
|
100
|
+
transform: rotate(-90deg);
|
|
101
|
+
transform-origin: center;
|
|
102
|
+
transform-box: fill-box;
|
|
103
|
+
transition: all 0.5s;
|
|
104
|
+
}
|
|
105
|
+
@keyframes circle {
|
|
106
|
+
100% {
|
|
107
|
+
stroke-dashoffset: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.text,
|
|
112
|
+
.percent {
|
|
113
|
+
font-weight: 500;
|
|
114
|
+
}
|
|
115
|
+
text {
|
|
116
|
+
display: flex;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
align-items: center;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
121
|
</style>
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ct-loading__spinner">
|
|
3
|
-
<img src="../../../assets/img/icon_load_circle.png" alt="" />
|
|
4
|
-
<slot name="text"></slot>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
data() {
|
|
11
|
-
return {};
|
|
12
|
-
},
|
|
13
|
-
created() {},
|
|
14
|
-
mounted() {},
|
|
15
|
-
methods: {},
|
|
16
|
-
};
|
|
17
|
-
</script>
|
|
18
|
-
<style scoped lang='less'>
|
|
19
|
-
.ct-loading__spinner {
|
|
20
|
-
position: absolute;
|
|
21
|
-
left: 50%;
|
|
22
|
-
top: 50%;
|
|
23
|
-
transform: translate(-50%, -50%);
|
|
24
|
-
|
|
25
|
-
img {
|
|
26
|
-
width: 40px;
|
|
27
|
-
transform-origin: center;
|
|
28
|
-
animation: rotate 2s infinite linear;
|
|
29
|
-
}
|
|
30
|
-
@keyframes rotate {
|
|
31
|
-
0% {
|
|
32
|
-
transform: rotate(0deg);
|
|
33
|
-
}
|
|
34
|
-
100% {
|
|
35
|
-
transform: rotate(360deg);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ct-loading__spinner">
|
|
3
|
+
<img src="../../../assets/img/icon_load_circle.png" alt="" />
|
|
4
|
+
<slot name="text"></slot>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
data() {
|
|
11
|
+
return {};
|
|
12
|
+
},
|
|
13
|
+
created() {},
|
|
14
|
+
mounted() {},
|
|
15
|
+
methods: {},
|
|
16
|
+
};
|
|
17
|
+
</script>
|
|
18
|
+
<style scoped lang='less'>
|
|
19
|
+
.ct-loading__spinner {
|
|
20
|
+
position: absolute;
|
|
21
|
+
left: 50%;
|
|
22
|
+
top: 50%;
|
|
23
|
+
transform: translate(-50%, -50%);
|
|
24
|
+
|
|
25
|
+
img {
|
|
26
|
+
width: 40px;
|
|
27
|
+
transform-origin: center;
|
|
28
|
+
animation: rotate 2s infinite linear;
|
|
29
|
+
}
|
|
30
|
+
@keyframes rotate {
|
|
31
|
+
0% {
|
|
32
|
+
transform: rotate(0deg);
|
|
33
|
+
}
|
|
34
|
+
100% {
|
|
35
|
+
transform: rotate(360deg);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
39
|
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import CtMenu from './src/menu.vue';
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
CtMenu.install = function (Vue) {
|
|
5
|
-
Vue.component('CtMenu', CtMenu);
|
|
6
|
-
};
|
|
7
|
-
|
|
1
|
+
import CtMenu from './src/menu.vue';
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
CtMenu.install = function (Vue) {
|
|
5
|
+
Vue.component('CtMenu', CtMenu);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
8
|
export default CtMenu;
|