fast-vue-multi-pages 1.0.25 → 1.0.27
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.
@@ -0,0 +1,100 @@
|
|
1
|
+
<script>
|
2
|
+
import {defineComponent} from 'vue'
|
3
|
+
import {FastVueMultiTool} from "fast-vue-multi-pages";
|
4
|
+
|
5
|
+
export default defineComponent({
|
6
|
+
name: "fast-panel-collapse",
|
7
|
+
props: {
|
8
|
+
collapsed: {
|
9
|
+
type: Boolean,
|
10
|
+
default: false
|
11
|
+
},
|
12
|
+
duration: {
|
13
|
+
type: Number,
|
14
|
+
default: 300
|
15
|
+
},
|
16
|
+
showEasing: {
|
17
|
+
type: String,
|
18
|
+
default: 'linear'
|
19
|
+
},
|
20
|
+
closeEasing: {
|
21
|
+
type: String,
|
22
|
+
default: 'linear'
|
23
|
+
}
|
24
|
+
},
|
25
|
+
emits: ["update:collapsed"],
|
26
|
+
watch: {
|
27
|
+
collapsed(newValue) {
|
28
|
+
if (newValue) {
|
29
|
+
this.closePanel();
|
30
|
+
} else {
|
31
|
+
this.showPanel();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},
|
35
|
+
data() {
|
36
|
+
return {
|
37
|
+
panelCode: "",
|
38
|
+
initSize: {
|
39
|
+
width: 0,
|
40
|
+
height: 0
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
created() {
|
45
|
+
this.panelCode = FastVueMultiTool.UUID.buildOnlyCode("Panel");
|
46
|
+
this.$nextTick(() => {
|
47
|
+
this.initSize = FastVueMultiTool.Element.getRealSize(this.$refs.panel);
|
48
|
+
if (this.collapsed) {
|
49
|
+
this.$refs.panel.style.display = "none";
|
50
|
+
}
|
51
|
+
});
|
52
|
+
},
|
53
|
+
methods: {
|
54
|
+
showPanel() {
|
55
|
+
FastVueMultiTool.Animate.startValueAnimate(this.panelCode, {
|
56
|
+
from: 0,
|
57
|
+
to: this.initSize.height,
|
58
|
+
duration: this.duration,
|
59
|
+
easing: this.showEasing,
|
60
|
+
update: (value) => {
|
61
|
+
this.$refs.panel.style.height = value + "px";
|
62
|
+
},
|
63
|
+
begin: () => {
|
64
|
+
this.$refs.panel.style.display = "block";
|
65
|
+
},
|
66
|
+
complete: () => {
|
67
|
+
this.$refs.panel.style.display = "block";
|
68
|
+
this.$refs.panel.style.height = "auto";
|
69
|
+
},
|
70
|
+
});
|
71
|
+
},
|
72
|
+
closePanel() {
|
73
|
+
FastVueMultiTool.Animate.startValueAnimate(this.panelCode, {
|
74
|
+
from: this.initSize.height,
|
75
|
+
to: 0,
|
76
|
+
duration: this.duration,
|
77
|
+
easing: this.closeEasing,
|
78
|
+
update: (value) => {
|
79
|
+
this.$refs.panel.style.height = value + "px";
|
80
|
+
},
|
81
|
+
complete: () => {
|
82
|
+
this.$refs.panel.style.display = "none";
|
83
|
+
},
|
84
|
+
});
|
85
|
+
},
|
86
|
+
}
|
87
|
+
});
|
88
|
+
</script>
|
89
|
+
|
90
|
+
<template>
|
91
|
+
<div ref="panel" class="fast-panel-collapse">
|
92
|
+
<slot/>
|
93
|
+
</div>
|
94
|
+
</template>
|
95
|
+
|
96
|
+
<style scoped>
|
97
|
+
.fast-panel-collapse {
|
98
|
+
overflow: hidden;
|
99
|
+
}
|
100
|
+
</style>
|
@@ -11,27 +11,28 @@ class FastVueMultiAnimate {
|
|
11
11
|
static startValueAnimate(animateCode, animateConfig) {
|
12
12
|
this.clearAnimate(animateCode);
|
13
13
|
let params = ValueAnimateConfig.newParam(animateConfig);
|
14
|
+
let animObj = {
|
15
|
+
value: params.from,
|
16
|
+
};
|
14
17
|
const anime = require('animejs');
|
15
18
|
this.animateMap[animateCode] = anime.default({
|
16
|
-
targets:
|
17
|
-
value: params.from,
|
18
|
-
},
|
19
|
+
targets: animObj,
|
19
20
|
value: params.to,
|
20
21
|
easing: params.easing,
|
21
22
|
duration: params.duration,
|
22
23
|
delay: params.delay,
|
23
|
-
_params: params,
|
24
24
|
update: function () {
|
25
|
-
|
25
|
+
params.update(animObj.value);
|
26
26
|
},
|
27
27
|
changeBegin: function (anim) {
|
28
|
-
|
28
|
+
params.changeBegin(anim);
|
29
29
|
},
|
30
30
|
begin: function (anim) {
|
31
|
-
|
31
|
+
params.begin(anim);
|
32
32
|
},
|
33
33
|
complete: function (anim) {
|
34
|
-
|
34
|
+
params.complete(anim);
|
35
|
+
FastVueMultiAnimate.clearAnimate(animateCode);
|
35
36
|
}
|
36
37
|
});
|
37
38
|
}
|
@@ -13,27 +13,28 @@ define(["require", "exports"], function (require, exports) {
|
|
13
13
|
FastVueMultiAnimate.startValueAnimate = function (animateCode, animateConfig) {
|
14
14
|
this.clearAnimate(animateCode);
|
15
15
|
var params = ValueAnimateConfig.newParam(animateConfig);
|
16
|
+
var animObj = {
|
17
|
+
value: params.from,
|
18
|
+
};
|
16
19
|
var anime = require('animejs');
|
17
20
|
this.animateMap[animateCode] = anime.default({
|
18
|
-
targets:
|
19
|
-
value: params.from,
|
20
|
-
},
|
21
|
+
targets: animObj,
|
21
22
|
value: params.to,
|
22
23
|
easing: params.easing,
|
23
24
|
duration: params.duration,
|
24
25
|
delay: params.delay,
|
25
|
-
_params: params,
|
26
26
|
update: function () {
|
27
|
-
|
27
|
+
params.update(animObj.value);
|
28
28
|
},
|
29
29
|
changeBegin: function (anim) {
|
30
|
-
|
30
|
+
params.changeBegin(anim);
|
31
31
|
},
|
32
32
|
begin: function (anim) {
|
33
|
-
|
33
|
+
params.begin(anim);
|
34
34
|
},
|
35
35
|
complete: function (anim) {
|
36
|
-
|
36
|
+
params.complete(anim);
|
37
|
+
FastVueMultiAnimate.clearAnimate(animateCode);
|
37
38
|
}
|
38
39
|
});
|
39
40
|
};
|