unika-components 1.0.250 → 1.0.252
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.
|
@@ -4,24 +4,25 @@ import 'swiper/swiper-bundle.css';
|
|
|
4
4
|
declare const _default: import("vue").DefineComponent<{
|
|
5
5
|
work: {
|
|
6
6
|
type: PropType<WorkData>;
|
|
7
|
-
|
|
7
|
+
require: boolean;
|
|
8
8
|
};
|
|
9
9
|
components: {
|
|
10
10
|
type: PropType<ComponentData[]>;
|
|
11
11
|
};
|
|
12
12
|
}, {
|
|
13
13
|
componentRefs: import("vue").Ref<Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>>;
|
|
14
|
-
setComponentRef: (el:
|
|
14
|
+
setComponentRef: (el: any) => void;
|
|
15
15
|
onSlideChange: (swiper: any) => void;
|
|
16
16
|
onSwiper: (swiper: any) => void;
|
|
17
17
|
modules: import("swiper/types").SwiperComponent[];
|
|
18
18
|
direction: string;
|
|
19
19
|
upArrow: import("vue").Ref<boolean>;
|
|
20
|
+
slideChangeTransitionEnd: (e: any) => void;
|
|
20
21
|
slideClasses: (index: number) => string[];
|
|
21
22
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
23
|
work: {
|
|
23
24
|
type: PropType<WorkData>;
|
|
24
|
-
|
|
25
|
+
require: boolean;
|
|
25
26
|
};
|
|
26
27
|
components: {
|
|
27
28
|
type: PropType<ComponentData[]>;
|
|
@@ -1,4 +1,84 @@
|
|
|
1
1
|
|
|
2
|
+
.slide-guide {
|
|
3
|
+
position: absolute;
|
|
4
|
+
bottom: 90px;
|
|
5
|
+
left: 50%;
|
|
6
|
+
transform: translateX(-50%);
|
|
7
|
+
}
|
|
8
|
+
.slide-guide img {
|
|
9
|
+
animation: flowing 2s ease-in-out infinite;
|
|
10
|
+
width: 33px;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
border-style: none;
|
|
13
|
+
}
|
|
14
|
+
body, html {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
margin: 0px;
|
|
19
|
+
}
|
|
20
|
+
.swiper-container {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
.swiper-slide {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
background-size: cover;
|
|
29
|
+
background-position: center;
|
|
30
|
+
background-repeat: no-repeat;
|
|
31
|
+
}
|
|
32
|
+
.up-arrow {
|
|
33
|
+
width: 2rem;
|
|
34
|
+
height: 2rem;
|
|
35
|
+
position: fixed;
|
|
36
|
+
bottom: 2rem;
|
|
37
|
+
left: 50%;
|
|
38
|
+
transform: translate3d(-50%, 0, 0);
|
|
39
|
+
z-index: 999;
|
|
40
|
+
background: none;
|
|
41
|
+
border: none;
|
|
42
|
+
padding: 0;
|
|
43
|
+
animation: upArrowAni 2s infinite linear;
|
|
44
|
+
}
|
|
45
|
+
.up-arrow img {
|
|
46
|
+
width: 2rem;
|
|
47
|
+
height: 2rem;
|
|
48
|
+
text-align: center;
|
|
49
|
+
line-height: 2rem;
|
|
50
|
+
color: #fff;
|
|
51
|
+
font-size: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
@keyframes upArrowAni {
|
|
54
|
+
0% {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transform: translate3d(-50%, 30%, 0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
30% {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
transform: translate3d(-50%, -20%, 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
60% {
|
|
65
|
+
opacity: 0;
|
|
66
|
+
transform: translate3d(-50%, -35%, 0);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
100% {
|
|
70
|
+
opacity: 0;
|
|
71
|
+
transform: translate3d(-50%, -50%, 0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.uni-image-component {
|
|
76
|
+
max-width: 100%;
|
|
77
|
+
}
|
|
78
|
+
.uni-image-mask-wrapper {
|
|
79
|
+
display: inline-block;
|
|
80
|
+
}
|
|
81
|
+
|
|
2
82
|
h2.uni-text-component, p.uni-text-component {
|
|
3
83
|
margin-bottom: 0;
|
|
4
84
|
}
|
|
@@ -10,25 +90,6 @@ button.uni-text-component {
|
|
|
10
90
|
box-sizing: border-box;
|
|
11
91
|
white-space: pre-wrap;
|
|
12
92
|
}
|
|
13
|
-
|
|
14
|
-
.uni-image-component {
|
|
15
|
-
max-width: 100%;
|
|
16
|
-
}
|
|
17
|
-
.uni-image-mask-wrapper {
|
|
18
|
-
display: inline-block;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.uni-calendar-component {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
.slot-number {
|
|
26
|
-
position: absolute;
|
|
27
|
-
bottom: 2px;
|
|
28
|
-
left: 7px;
|
|
29
|
-
font-size: 12px;
|
|
30
|
-
color: #666
|
|
31
|
-
}
|
|
32
93
|
|
|
33
94
|
.uni-video-component {
|
|
34
95
|
position: relative;
|
|
@@ -51,6 +112,11 @@ button.uni-text-component {
|
|
|
51
112
|
background: rgba(0, 0, 0, 0.8);
|
|
52
113
|
}
|
|
53
114
|
|
|
115
|
+
.uni-lotties-component {
|
|
116
|
+
width: 100%;
|
|
117
|
+
height: 100%;
|
|
118
|
+
}
|
|
119
|
+
|
|
54
120
|
.like-button {
|
|
55
121
|
display: flex;
|
|
56
122
|
flex-direction: column;
|
|
@@ -72,76 +138,18 @@ button.uni-text-component {
|
|
|
72
138
|
font-size: 16px;
|
|
73
139
|
color: #333;
|
|
74
140
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
body, html {
|
|
89
|
-
position: relative;
|
|
90
|
-
width: 100%;
|
|
91
|
-
height: 100%;
|
|
92
|
-
margin: 0px;
|
|
93
|
-
}
|
|
94
|
-
.swiper-container {
|
|
95
|
-
width: 100%;
|
|
96
|
-
height: 100%;
|
|
97
|
-
}
|
|
98
|
-
.swiper-slide {
|
|
99
|
-
width: 100%;
|
|
100
|
-
height: 100%;
|
|
101
|
-
overflow: hidden;
|
|
102
|
-
background-size: cover;
|
|
103
|
-
background-position: center;
|
|
104
|
-
background-repeat: no-repeat;
|
|
105
|
-
}
|
|
106
|
-
.up-arrow {
|
|
107
|
-
width: 2rem;
|
|
108
|
-
height: 2rem;
|
|
109
|
-
position: fixed;
|
|
110
|
-
bottom: 2rem;
|
|
111
|
-
left: 50%;
|
|
112
|
-
transform: translate3d(-50%, 0, 0);
|
|
113
|
-
z-index: 999;
|
|
114
|
-
background: none;
|
|
115
|
-
border: none;
|
|
116
|
-
padding: 0;
|
|
117
|
-
animation: upArrowAni 2s infinite linear;
|
|
118
|
-
}
|
|
119
|
-
.up-arrow img {
|
|
120
|
-
width: 2rem;
|
|
121
|
-
height: 2rem;
|
|
122
|
-
text-align: center;
|
|
123
|
-
line-height: 2rem;
|
|
124
|
-
color: #fff;
|
|
125
|
-
font-size: 1.5rem;
|
|
126
|
-
}
|
|
127
|
-
@keyframes upArrowAni {
|
|
128
|
-
0% {
|
|
129
|
-
opacity: 0;
|
|
130
|
-
transform: translate3d(-50%, 30%, 0);
|
|
131
|
-
}
|
|
132
|
-
30% {
|
|
133
|
-
opacity: 1;
|
|
134
|
-
transform: translate3d(-50%, -20%, 0);
|
|
135
|
-
}
|
|
136
|
-
60% {
|
|
137
|
-
opacity: 0;
|
|
138
|
-
transform: translate3d(-50%, -35%, 0);
|
|
139
|
-
}
|
|
140
|
-
100% {
|
|
141
|
-
opacity: 0;
|
|
142
|
-
transform: translate3d(-50%, -50%, 0);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
.uni-calendar-component {
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
.slot-number {
|
|
147
|
+
position: absolute;
|
|
148
|
+
bottom: 2px;
|
|
149
|
+
left: 7px;
|
|
150
|
+
font-size: 12px;
|
|
151
|
+
color: #666
|
|
152
|
+
}
|
|
145
153
|
|
|
146
154
|
.ant-input-number {
|
|
147
155
|
box-sizing: border-box;
|
|
@@ -177,10 +185,6 @@ body, html {
|
|
|
177
185
|
margin-bottom: 0px;
|
|
178
186
|
vertical-align: top;
|
|
179
187
|
}
|
|
180
|
-
|
|
181
|
-
.uni-svg-component {
|
|
182
|
-
display: inline-block;
|
|
183
|
-
}
|
|
184
188
|
|
|
185
189
|
.swiper-warp {
|
|
186
190
|
width: 100%;
|
|
@@ -196,13 +200,12 @@ body, html {
|
|
|
196
200
|
max-height: 100%;
|
|
197
201
|
}
|
|
198
202
|
|
|
199
|
-
.uni-lotties-component {
|
|
200
|
-
width: 100%;
|
|
201
|
-
height: 100%;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
203
|
.uni-build-up-component {
|
|
205
204
|
}
|
|
205
|
+
|
|
206
|
+
.uni-svg-component {
|
|
207
|
+
display: inline-block;
|
|
208
|
+
}
|
|
206
209
|
|
|
207
210
|
.effect {
|
|
208
211
|
width: 100%;
|
|
@@ -12995,30 +12995,138 @@ var SwiperSlide = {
|
|
|
12995
12995
|
}
|
|
12996
12996
|
};
|
|
12997
12997
|
|
|
12998
|
+
//隐藏元素
|
|
12999
|
+
const swiperAnimateCache = () => {
|
|
13000
|
+
const allBoxes = window.document.documentElement.querySelectorAll(".animation");
|
|
13001
|
+
for (let i = 0; i < allBoxes.length; i++) {
|
|
13002
|
+
allBoxes[i].attributes["style"]
|
|
13003
|
+
? allBoxes[i].setAttribute("swiper-animate-style-cache", allBoxes[i].attributes["style"].value)
|
|
13004
|
+
: allBoxes[i].setAttribute("swiper-animate-style-cache", " ");
|
|
13005
|
+
allBoxes[i].style.visibility = "hidden";
|
|
13006
|
+
}
|
|
13007
|
+
};
|
|
13008
|
+
// 开始动画
|
|
13009
|
+
const swiperAnimate = (a) => {
|
|
13010
|
+
//每次添加的时候先把样式清除一遍
|
|
13011
|
+
clearSwiperAnimate();
|
|
13012
|
+
const b = a.slides[a.activeIndex].querySelectorAll(".animation");
|
|
13013
|
+
for (let i = 0; i < b.length; i++) {
|
|
13014
|
+
b[i].style.visibility = "visible";
|
|
13015
|
+
const effect = b[i].attributes["swiper-animate-effect"]
|
|
13016
|
+
? b[i].attributes["swiper-animate-effect"].value
|
|
13017
|
+
: "";
|
|
13018
|
+
b[i].className = b[i].className + " " + effect + " " + "animated";
|
|
13019
|
+
const duration = b[i].attributes["swiper-animate-duration"]
|
|
13020
|
+
? b[i].attributes["swiper-animate-duration"].value
|
|
13021
|
+
: "";
|
|
13022
|
+
// duration && style
|
|
13023
|
+
const delay = b[i].attributes["swiper-animate-delay"]
|
|
13024
|
+
? b[i].attributes["swiper-animate-delay"].value
|
|
13025
|
+
: "";
|
|
13026
|
+
const style = b[i].attributes["style"].value + "animation-duration:" + duration + ";-webkit-animation-duration:" + duration + ";" + "animation-delay:" + delay + ";-webkit-animation-delay:" + delay + ";";
|
|
13027
|
+
// delay && (style = style )
|
|
13028
|
+
b[i].setAttribute("style", style);
|
|
13029
|
+
}
|
|
13030
|
+
};
|
|
13031
|
+
// 清楚样式。 获取 .animation 类名, 注意这个所有的.animation 类名都会被获取,所以可以自己取
|
|
13032
|
+
const clearSwiperAnimate = () => {
|
|
13033
|
+
const allBoxes = window.document.documentElement.querySelectorAll(".animation");
|
|
13034
|
+
for (let i = 0; i < allBoxes.length; i++) {
|
|
13035
|
+
allBoxes[i].attributes["swiper-animate-style-cache"] && allBoxes[i].setAttribute("style", allBoxes[i].attributes["swiper-animate-style-cache"].value);
|
|
13036
|
+
allBoxes[i].style.visibility = "hidden";
|
|
13037
|
+
allBoxes[i].className = allBoxes[i].className.replace("animated", " ");
|
|
13038
|
+
const effectValue = allBoxes[i].attributes["swiper-animate-effect"].value;
|
|
13039
|
+
/* eslint-disable-next-line */
|
|
13040
|
+
allBoxes[i].attributes['swiper-animate-effect'] && (allBoxes[i].className = allBoxes[i].className.replace(effectValue, ' '));
|
|
13041
|
+
}
|
|
13042
|
+
};
|
|
13043
|
+
|
|
12998
13044
|
SwiperCore.use([Pagination$1, EffectFade]);
|
|
13045
|
+
function getComputedCSSText(style) {
|
|
13046
|
+
let cssText = '';
|
|
13047
|
+
for (const attr in style) {
|
|
13048
|
+
// #!zh: 驼峰转下划线
|
|
13049
|
+
cssText += `${attr.replace(/[A-Z]+/g, m => `-${m.toLowerCase()}`)}:${style[attr]};`;
|
|
13050
|
+
}
|
|
13051
|
+
return cssText;
|
|
13052
|
+
}
|
|
12999
13053
|
var script$h = defineComponent({
|
|
13000
|
-
name: '
|
|
13054
|
+
name: 'swiper-page',
|
|
13001
13055
|
props: {
|
|
13002
13056
|
work: {
|
|
13003
13057
|
type: Object,
|
|
13004
|
-
|
|
13058
|
+
require: true
|
|
13005
13059
|
},
|
|
13006
13060
|
components: {
|
|
13007
|
-
type: Array
|
|
13008
|
-
}
|
|
13061
|
+
type: Array,
|
|
13062
|
+
},
|
|
13009
13063
|
},
|
|
13010
13064
|
components: {
|
|
13011
13065
|
Swiper,
|
|
13012
13066
|
SwiperSlide
|
|
13013
13067
|
},
|
|
13014
13068
|
setup(props) {
|
|
13069
|
+
// 重用并且简化
|
|
13070
|
+
// 抽离并且获得 styleProps
|
|
13015
13071
|
const componentRefs = ref(new Map());
|
|
13016
|
-
const upArrow = ref(true);
|
|
13017
13072
|
const setComponentRef = (el) => {
|
|
13018
13073
|
if (el) {
|
|
13019
13074
|
componentRefs.value.set(el.id, el);
|
|
13020
13075
|
}
|
|
13021
13076
|
};
|
|
13077
|
+
const upArrow = ref(true);
|
|
13078
|
+
const runAnimations = (currentIndex) => {
|
|
13079
|
+
const pages = cloneDeep$1(props.work && props.work.pages);
|
|
13080
|
+
pages[currentIndex].components && pages[currentIndex].components.forEach((component) => {
|
|
13081
|
+
const animationQueue = component.animations || [];
|
|
13082
|
+
const len = animationQueue.length;
|
|
13083
|
+
if (len === 0)
|
|
13084
|
+
return;
|
|
13085
|
+
let animIdx = 0;
|
|
13086
|
+
const oldStyle = { ...component.props };
|
|
13087
|
+
oldStyle.position = 'absolute'; // 添加绝对布局
|
|
13088
|
+
const runAnimation = () => {
|
|
13089
|
+
if (animIdx < len) {
|
|
13090
|
+
const animation = animationQueue[animIdx];
|
|
13091
|
+
const animationStyle = {
|
|
13092
|
+
animationName: animation.type,
|
|
13093
|
+
animationDuration: `${animation.duration}s`,
|
|
13094
|
+
animationIterationCount: animation.infinite ? 'infinite' : animation.interationCount,
|
|
13095
|
+
animationDelay: `${animation.delay}s`,
|
|
13096
|
+
animationFillMode: 'both',
|
|
13097
|
+
position: 'absolute' // 确保动画期间元素使用绝对布局
|
|
13098
|
+
};
|
|
13099
|
+
const element = componentRefs.value.get('component-' + component.id);
|
|
13100
|
+
if (element) {
|
|
13101
|
+
const innerElement = element.querySelector('.inner-component');
|
|
13102
|
+
if (innerElement) {
|
|
13103
|
+
// element.style.cssText = getComputedCSSText(animationStyle) + getComputedCSSText(oldStyle);
|
|
13104
|
+
innerElement.style.cssText = getComputedCSSText(animationStyle) + getComputedCSSText(oldStyle);
|
|
13105
|
+
animIdx++;
|
|
13106
|
+
}
|
|
13107
|
+
}
|
|
13108
|
+
}
|
|
13109
|
+
else {
|
|
13110
|
+
const element = componentRefs.value.get('component-' + component.id);
|
|
13111
|
+
if (element) {
|
|
13112
|
+
const innerElement = element.querySelector('.inner-component');
|
|
13113
|
+
if (innerElement) {
|
|
13114
|
+
innerElement.style.cssText = getComputedCSSText(oldStyle);
|
|
13115
|
+
}
|
|
13116
|
+
}
|
|
13117
|
+
}
|
|
13118
|
+
};
|
|
13119
|
+
runAnimation();
|
|
13120
|
+
const element = componentRefs.value.get('component-' + component.id);
|
|
13121
|
+
if (element) {
|
|
13122
|
+
const innerElement = element.querySelector('.inner-component');
|
|
13123
|
+
if (innerElement) {
|
|
13124
|
+
innerElement.addEventListener('animationend', runAnimation, false);
|
|
13125
|
+
innerElement.addEventListener('webkitAnimationEnd', runAnimation, false);
|
|
13126
|
+
}
|
|
13127
|
+
}
|
|
13128
|
+
});
|
|
13129
|
+
};
|
|
13022
13130
|
const reloadAnimation = (componentId) => {
|
|
13023
13131
|
const component = componentRefs.value.get(`component-${componentId}`);
|
|
13024
13132
|
if (component) {
|
|
@@ -13037,24 +13145,33 @@ var script$h = defineComponent({
|
|
|
13037
13145
|
};
|
|
13038
13146
|
const onSlideChange = (swiper) => {
|
|
13039
13147
|
const currentIndex = swiper.activeIndex;
|
|
13040
|
-
|
|
13041
|
-
|
|
13148
|
+
console.log('Slide changed to:', currentIndex); // 添加调试信息
|
|
13149
|
+
runAnimations(currentIndex);
|
|
13150
|
+
if (currentIndex === swiper.slides.length - 1) {
|
|
13151
|
+
upArrow.value = false;
|
|
13152
|
+
}
|
|
13153
|
+
else {
|
|
13154
|
+
upArrow.value = true;
|
|
13155
|
+
}
|
|
13156
|
+
swiperAnimate(swiper);
|
|
13157
|
+
const currentPage = props.work?.pages[currentIndex];
|
|
13158
|
+
currentPage?.components.forEach((component) => {
|
|
13042
13159
|
if (component.name === 'uni-lotties') {
|
|
13043
13160
|
reloadAnimation(component.id);
|
|
13044
13161
|
}
|
|
13045
13162
|
});
|
|
13046
|
-
|
|
13163
|
+
};
|
|
13164
|
+
const slideChangeTransitionEnd = (e) => {
|
|
13165
|
+
swiperAnimate(e);
|
|
13047
13166
|
};
|
|
13048
13167
|
const onSwiper = (swiper) => {
|
|
13168
|
+
swiperAnimateCache();
|
|
13169
|
+
swiperAnimate(swiper);
|
|
13049
13170
|
const currentIndex = swiper.activeIndex;
|
|
13050
|
-
|
|
13051
|
-
currentPage.components.forEach((component) => {
|
|
13052
|
-
if (component.name === 'uni-lotties') {
|
|
13053
|
-
reloadAnimation(component.id);
|
|
13054
|
-
}
|
|
13055
|
-
});
|
|
13171
|
+
runAnimations(currentIndex);
|
|
13056
13172
|
};
|
|
13057
13173
|
const direction = 'vertical';
|
|
13174
|
+
// const effect = 'fade'
|
|
13058
13175
|
const slideClasses = (index) => {
|
|
13059
13176
|
return ['swiper-slide', `slide-${index}`];
|
|
13060
13177
|
};
|
|
@@ -13065,7 +13182,9 @@ var script$h = defineComponent({
|
|
|
13065
13182
|
onSwiper,
|
|
13066
13183
|
modules: [EffectFade],
|
|
13067
13184
|
direction,
|
|
13185
|
+
// effect,
|
|
13068
13186
|
upArrow,
|
|
13187
|
+
slideChangeTransitionEnd,
|
|
13069
13188
|
slideClasses
|
|
13070
13189
|
};
|
|
13071
13190
|
}
|
|
@@ -13117,8 +13236,8 @@ function render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
13117
13236
|
id: `component-${item.id}`,
|
|
13118
13237
|
style: {"width":"100%","height":"100%"}
|
|
13119
13238
|
}, [
|
|
13120
|
-
(item.name
|
|
13121
|
-
? (openBlock(), createBlock(resolveDynamicComponent(item.name), mergeProps({ key: 0 }, item.props
|
|
13239
|
+
(item.name != 'uni-build-up' && !item.isHidden)
|
|
13240
|
+
? (openBlock(), createBlock(resolveDynamicComponent(item.name), normalizeProps(mergeProps({ key: 0 }, item.props)), null, 16 /* FULL_PROPS */))
|
|
13122
13241
|
: createCommentVNode("v-if", true)
|
|
13123
13242
|
], 8 /* PROPS */, _hoisted_2$3))
|
|
13124
13243
|
}), 128 /* KEYED_FRAGMENT */))
|
|
@@ -13002,30 +13002,138 @@
|
|
|
13002
13002
|
}
|
|
13003
13003
|
};
|
|
13004
13004
|
|
|
13005
|
+
//隐藏元素
|
|
13006
|
+
const swiperAnimateCache = () => {
|
|
13007
|
+
const allBoxes = window.document.documentElement.querySelectorAll(".animation");
|
|
13008
|
+
for (let i = 0; i < allBoxes.length; i++) {
|
|
13009
|
+
allBoxes[i].attributes["style"]
|
|
13010
|
+
? allBoxes[i].setAttribute("swiper-animate-style-cache", allBoxes[i].attributes["style"].value)
|
|
13011
|
+
: allBoxes[i].setAttribute("swiper-animate-style-cache", " ");
|
|
13012
|
+
allBoxes[i].style.visibility = "hidden";
|
|
13013
|
+
}
|
|
13014
|
+
};
|
|
13015
|
+
// 开始动画
|
|
13016
|
+
const swiperAnimate = (a) => {
|
|
13017
|
+
//每次添加的时候先把样式清除一遍
|
|
13018
|
+
clearSwiperAnimate();
|
|
13019
|
+
const b = a.slides[a.activeIndex].querySelectorAll(".animation");
|
|
13020
|
+
for (let i = 0; i < b.length; i++) {
|
|
13021
|
+
b[i].style.visibility = "visible";
|
|
13022
|
+
const effect = b[i].attributes["swiper-animate-effect"]
|
|
13023
|
+
? b[i].attributes["swiper-animate-effect"].value
|
|
13024
|
+
: "";
|
|
13025
|
+
b[i].className = b[i].className + " " + effect + " " + "animated";
|
|
13026
|
+
const duration = b[i].attributes["swiper-animate-duration"]
|
|
13027
|
+
? b[i].attributes["swiper-animate-duration"].value
|
|
13028
|
+
: "";
|
|
13029
|
+
// duration && style
|
|
13030
|
+
const delay = b[i].attributes["swiper-animate-delay"]
|
|
13031
|
+
? b[i].attributes["swiper-animate-delay"].value
|
|
13032
|
+
: "";
|
|
13033
|
+
const style = b[i].attributes["style"].value + "animation-duration:" + duration + ";-webkit-animation-duration:" + duration + ";" + "animation-delay:" + delay + ";-webkit-animation-delay:" + delay + ";";
|
|
13034
|
+
// delay && (style = style )
|
|
13035
|
+
b[i].setAttribute("style", style);
|
|
13036
|
+
}
|
|
13037
|
+
};
|
|
13038
|
+
// 清楚样式。 获取 .animation 类名, 注意这个所有的.animation 类名都会被获取,所以可以自己取
|
|
13039
|
+
const clearSwiperAnimate = () => {
|
|
13040
|
+
const allBoxes = window.document.documentElement.querySelectorAll(".animation");
|
|
13041
|
+
for (let i = 0; i < allBoxes.length; i++) {
|
|
13042
|
+
allBoxes[i].attributes["swiper-animate-style-cache"] && allBoxes[i].setAttribute("style", allBoxes[i].attributes["swiper-animate-style-cache"].value);
|
|
13043
|
+
allBoxes[i].style.visibility = "hidden";
|
|
13044
|
+
allBoxes[i].className = allBoxes[i].className.replace("animated", " ");
|
|
13045
|
+
const effectValue = allBoxes[i].attributes["swiper-animate-effect"].value;
|
|
13046
|
+
/* eslint-disable-next-line */
|
|
13047
|
+
allBoxes[i].attributes['swiper-animate-effect'] && (allBoxes[i].className = allBoxes[i].className.replace(effectValue, ' '));
|
|
13048
|
+
}
|
|
13049
|
+
};
|
|
13050
|
+
|
|
13005
13051
|
SwiperCore.use([Pagination$1, EffectFade]);
|
|
13052
|
+
function getComputedCSSText(style) {
|
|
13053
|
+
let cssText = '';
|
|
13054
|
+
for (const attr in style) {
|
|
13055
|
+
// #!zh: 驼峰转下划线
|
|
13056
|
+
cssText += `${attr.replace(/[A-Z]+/g, m => `-${m.toLowerCase()}`)}:${style[attr]};`;
|
|
13057
|
+
}
|
|
13058
|
+
return cssText;
|
|
13059
|
+
}
|
|
13006
13060
|
var script$h = vue.defineComponent({
|
|
13007
|
-
name: '
|
|
13061
|
+
name: 'swiper-page',
|
|
13008
13062
|
props: {
|
|
13009
13063
|
work: {
|
|
13010
13064
|
type: Object,
|
|
13011
|
-
|
|
13065
|
+
require: true
|
|
13012
13066
|
},
|
|
13013
13067
|
components: {
|
|
13014
|
-
type: Array
|
|
13015
|
-
}
|
|
13068
|
+
type: Array,
|
|
13069
|
+
},
|
|
13016
13070
|
},
|
|
13017
13071
|
components: {
|
|
13018
13072
|
Swiper,
|
|
13019
13073
|
SwiperSlide
|
|
13020
13074
|
},
|
|
13021
13075
|
setup(props) {
|
|
13076
|
+
// 重用并且简化
|
|
13077
|
+
// 抽离并且获得 styleProps
|
|
13022
13078
|
const componentRefs = vue.ref(new Map());
|
|
13023
|
-
const upArrow = vue.ref(true);
|
|
13024
13079
|
const setComponentRef = (el) => {
|
|
13025
13080
|
if (el) {
|
|
13026
13081
|
componentRefs.value.set(el.id, el);
|
|
13027
13082
|
}
|
|
13028
13083
|
};
|
|
13084
|
+
const upArrow = vue.ref(true);
|
|
13085
|
+
const runAnimations = (currentIndex) => {
|
|
13086
|
+
const pages = cloneDeep$1(props.work && props.work.pages);
|
|
13087
|
+
pages[currentIndex].components && pages[currentIndex].components.forEach((component) => {
|
|
13088
|
+
const animationQueue = component.animations || [];
|
|
13089
|
+
const len = animationQueue.length;
|
|
13090
|
+
if (len === 0)
|
|
13091
|
+
return;
|
|
13092
|
+
let animIdx = 0;
|
|
13093
|
+
const oldStyle = { ...component.props };
|
|
13094
|
+
oldStyle.position = 'absolute'; // 添加绝对布局
|
|
13095
|
+
const runAnimation = () => {
|
|
13096
|
+
if (animIdx < len) {
|
|
13097
|
+
const animation = animationQueue[animIdx];
|
|
13098
|
+
const animationStyle = {
|
|
13099
|
+
animationName: animation.type,
|
|
13100
|
+
animationDuration: `${animation.duration}s`,
|
|
13101
|
+
animationIterationCount: animation.infinite ? 'infinite' : animation.interationCount,
|
|
13102
|
+
animationDelay: `${animation.delay}s`,
|
|
13103
|
+
animationFillMode: 'both',
|
|
13104
|
+
position: 'absolute' // 确保动画期间元素使用绝对布局
|
|
13105
|
+
};
|
|
13106
|
+
const element = componentRefs.value.get('component-' + component.id);
|
|
13107
|
+
if (element) {
|
|
13108
|
+
const innerElement = element.querySelector('.inner-component');
|
|
13109
|
+
if (innerElement) {
|
|
13110
|
+
// element.style.cssText = getComputedCSSText(animationStyle) + getComputedCSSText(oldStyle);
|
|
13111
|
+
innerElement.style.cssText = getComputedCSSText(animationStyle) + getComputedCSSText(oldStyle);
|
|
13112
|
+
animIdx++;
|
|
13113
|
+
}
|
|
13114
|
+
}
|
|
13115
|
+
}
|
|
13116
|
+
else {
|
|
13117
|
+
const element = componentRefs.value.get('component-' + component.id);
|
|
13118
|
+
if (element) {
|
|
13119
|
+
const innerElement = element.querySelector('.inner-component');
|
|
13120
|
+
if (innerElement) {
|
|
13121
|
+
innerElement.style.cssText = getComputedCSSText(oldStyle);
|
|
13122
|
+
}
|
|
13123
|
+
}
|
|
13124
|
+
}
|
|
13125
|
+
};
|
|
13126
|
+
runAnimation();
|
|
13127
|
+
const element = componentRefs.value.get('component-' + component.id);
|
|
13128
|
+
if (element) {
|
|
13129
|
+
const innerElement = element.querySelector('.inner-component');
|
|
13130
|
+
if (innerElement) {
|
|
13131
|
+
innerElement.addEventListener('animationend', runAnimation, false);
|
|
13132
|
+
innerElement.addEventListener('webkitAnimationEnd', runAnimation, false);
|
|
13133
|
+
}
|
|
13134
|
+
}
|
|
13135
|
+
});
|
|
13136
|
+
};
|
|
13029
13137
|
const reloadAnimation = (componentId) => {
|
|
13030
13138
|
const component = componentRefs.value.get(`component-${componentId}`);
|
|
13031
13139
|
if (component) {
|
|
@@ -13044,24 +13152,33 @@
|
|
|
13044
13152
|
};
|
|
13045
13153
|
const onSlideChange = (swiper) => {
|
|
13046
13154
|
const currentIndex = swiper.activeIndex;
|
|
13047
|
-
|
|
13048
|
-
|
|
13155
|
+
console.log('Slide changed to:', currentIndex); // 添加调试信息
|
|
13156
|
+
runAnimations(currentIndex);
|
|
13157
|
+
if (currentIndex === swiper.slides.length - 1) {
|
|
13158
|
+
upArrow.value = false;
|
|
13159
|
+
}
|
|
13160
|
+
else {
|
|
13161
|
+
upArrow.value = true;
|
|
13162
|
+
}
|
|
13163
|
+
swiperAnimate(swiper);
|
|
13164
|
+
const currentPage = props.work?.pages[currentIndex];
|
|
13165
|
+
currentPage?.components.forEach((component) => {
|
|
13049
13166
|
if (component.name === 'uni-lotties') {
|
|
13050
13167
|
reloadAnimation(component.id);
|
|
13051
13168
|
}
|
|
13052
13169
|
});
|
|
13053
|
-
|
|
13170
|
+
};
|
|
13171
|
+
const slideChangeTransitionEnd = (e) => {
|
|
13172
|
+
swiperAnimate(e);
|
|
13054
13173
|
};
|
|
13055
13174
|
const onSwiper = (swiper) => {
|
|
13175
|
+
swiperAnimateCache();
|
|
13176
|
+
swiperAnimate(swiper);
|
|
13056
13177
|
const currentIndex = swiper.activeIndex;
|
|
13057
|
-
|
|
13058
|
-
currentPage.components.forEach((component) => {
|
|
13059
|
-
if (component.name === 'uni-lotties') {
|
|
13060
|
-
reloadAnimation(component.id);
|
|
13061
|
-
}
|
|
13062
|
-
});
|
|
13178
|
+
runAnimations(currentIndex);
|
|
13063
13179
|
};
|
|
13064
13180
|
const direction = 'vertical';
|
|
13181
|
+
// const effect = 'fade'
|
|
13065
13182
|
const slideClasses = (index) => {
|
|
13066
13183
|
return ['swiper-slide', `slide-${index}`];
|
|
13067
13184
|
};
|
|
@@ -13072,7 +13189,9 @@
|
|
|
13072
13189
|
onSwiper,
|
|
13073
13190
|
modules: [EffectFade],
|
|
13074
13191
|
direction,
|
|
13192
|
+
// effect,
|
|
13075
13193
|
upArrow,
|
|
13194
|
+
slideChangeTransitionEnd,
|
|
13076
13195
|
slideClasses
|
|
13077
13196
|
};
|
|
13078
13197
|
}
|
|
@@ -13124,8 +13243,8 @@
|
|
|
13124
13243
|
id: `component-${item.id}`,
|
|
13125
13244
|
style: {"width":"100%","height":"100%"}
|
|
13126
13245
|
}, [
|
|
13127
|
-
(item.name
|
|
13128
|
-
? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.name), vue.mergeProps({ key: 0 }, item.props
|
|
13246
|
+
(item.name != 'uni-build-up' && !item.isHidden)
|
|
13247
|
+
? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.name), vue.normalizeProps(vue.mergeProps({ key: 0 }, item.props)), null, 16 /* FULL_PROPS */))
|
|
13129
13248
|
: vue.createCommentVNode("v-if", true)
|
|
13130
13249
|
], 8 /* PROPS */, _hoisted_2$3))
|
|
13131
13250
|
}), 128 /* KEYED_FRAGMENT */))
|