Skip to content

Commit 34a15ac

Browse files
fix: 🐛 修复 Swiper 在微信小程序平台轮播视频时在iOS平台全屏展示异常的问题 (#898)
Closes: #885
1 parent 031107d commit 34a15ac

2 files changed

Lines changed: 53 additions & 57 deletions

File tree

src/components/demo-block/demo-block.vue

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
<!--
2-
* @Author: weisheng
3-
* @Date: 2023-08-01 11:12:05
4-
* @LastEditTime: 2024-07-11 19:13:17
5-
* @LastEditors: weisheng
6-
* @Description:
7-
* @FilePath: \wot-design-uni\src\components\demo-block\demo-block.vue
8-
* 记得注释
9-
-->
101
<template>
112
<view :class="['demo-block', transparent ? '' : 'is-white', customClass]">
123
<view class="demo-title">{{ title }}</view>
@@ -69,7 +60,6 @@ function setStyle() {
6960
}
7061
7162
.demo-block {
72-
position: relative;
7363
color: #666;
7464
7565
&:not(:first-child) {

src/uni_modules/wot-design-uni/components/wd-swiper/wd-swiper.vue

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,59 @@
11
<template>
22
<view :class="`wd-swiper ${customClass}`" :style="customStyle">
3-
<swiper
4-
:adjust-height="adjustHeight"
5-
:adjust-vertical-height="adjustVerticalHeight"
6-
class="wd-swiper__track"
7-
:autoplay="autoplay && !videoPlaying"
8-
:current="navCurrent"
9-
:interval="interval"
10-
:duration="duration"
11-
:circular="loop"
12-
:vertical="direction == 'vertical'"
13-
:easing-function="easingFunction"
14-
:previous-margin="addUnit(previousMargin)"
15-
:next-margin="addUnit(nextMargin)"
16-
:snap-to-edge="snapToEdge"
17-
:display-multiple-items="displayMultipleItems"
18-
:style="{ height: addUnit(height) }"
19-
@change="handleChange"
20-
@animationfinish="handleAnimationfinish"
21-
>
22-
<swiper-item v-for="(item, index) in list" :key="index" class="wd-swiper__item">
23-
<video
24-
v-if="isVideo(item)"
25-
:id="`video-${index}-${uid}`"
26-
:style="{ height: addUnit(height) }"
27-
:src="isObj(item) ? item[valueKey] : item"
28-
:poster="isObj(item) ? item.poster : ''"
29-
:class="`wd-swiper__video ${customItemClass} ${getCustomItemClass(currentValue, index, list)}`"
30-
@play="handleVideoPaly"
31-
@pause="handleVideoPause"
32-
:enable-progress-gesture="false"
33-
:loop="videoLoop"
34-
:muted="muted"
35-
:autoplay="autoplayVideo"
36-
objectFit="cover"
37-
@click="handleClick(index, item)"
38-
/>
39-
<image
40-
v-else
41-
:src="isObj(item) ? item[valueKey] : item"
42-
:class="`wd-swiper__image ${customImageClass} ${customItemClass} ${getCustomItemClass(currentValue, index, list)}`"
43-
:style="{ height: addUnit(height) }"
44-
:mode="imageMode"
45-
@click="handleClick(index, item)"
46-
/>
3+
<!-- #ifdef MP-WEIXIN -->
4+
<scroll-view scroll-x scroll-y style="width: 100%; height: 100%">
5+
<!-- #endif -->
6+
<swiper
7+
:adjust-height="adjustHeight"
8+
:adjust-vertical-height="adjustVerticalHeight"
9+
class="wd-swiper__track"
10+
:autoplay="autoplay && !videoPlaying"
11+
:current="navCurrent"
12+
:interval="interval"
13+
:duration="duration"
14+
:circular="loop"
15+
:vertical="direction == 'vertical'"
16+
:easing-function="easingFunction"
17+
:previous-margin="addUnit(previousMargin)"
18+
:next-margin="addUnit(nextMargin)"
19+
:snap-to-edge="snapToEdge"
20+
:display-multiple-items="displayMultipleItems"
21+
:style="{ height: addUnit(height) }"
22+
@change="handleChange"
23+
@animationfinish="handleAnimationfinish"
24+
>
25+
<swiper-item v-for="(item, index) in list" :key="index" class="wd-swiper__item">
26+
<video
27+
v-if="isVideo(item)"
28+
:id="`video-${index}-${uid}`"
29+
:style="{ height: addUnit(height) }"
30+
:src="isObj(item) ? item[valueKey] : item"
31+
:poster="isObj(item) ? item.poster : ''"
32+
:class="`wd-swiper__video ${customItemClass} ${getCustomItemClass(currentValue, index, list)}`"
33+
@play="handleVideoPaly"
34+
@pause="handleVideoPause"
35+
:enable-progress-gesture="false"
36+
:loop="videoLoop"
37+
:muted="muted"
38+
:autoplay="autoplayVideo"
39+
objectFit="cover"
40+
@click="handleClick(index, item)"
41+
/>
42+
<image
43+
v-else
44+
:src="isObj(item) ? item[valueKey] : item"
45+
:class="`wd-swiper__image ${customImageClass} ${customItemClass} ${getCustomItemClass(currentValue, index, list)}`"
46+
:style="{ height: addUnit(height) }"
47+
:mode="imageMode"
48+
@click="handleClick(index, item)"
49+
/>
4750

48-
<text v-if="isObj(item) && item[textKey]" :class="`wd-swiper__text ${customTextClass}`" :style="customTextStyle">{{ item[textKey] }}</text>
49-
</swiper-item>
50-
</swiper>
51+
<text v-if="isObj(item) && item[textKey]" :class="`wd-swiper__text ${customTextClass}`" :style="customTextStyle">{{ item[textKey] }}</text>
52+
</swiper-item>
53+
</swiper>
54+
<!-- #ifdef MP-WEIXIN -->
55+
</scroll-view>
56+
<!-- #endif -->
5157

5258
<template v-if="indicator">
5359
<slot name="indicator" :current="currentValue" :total="list.length"></slot>

0 commit comments

Comments
 (0)