Skip to content

Commit 3eab119

Browse files
committed
fix(engine): click the next or prev not working; (zh) 修正预览弹窗中,点击上一页和下一页失败的问题
1 parent ef1278e commit 3eab119

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

back-end/h5-api/views/engine.ejs

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: ly525
33
* @Date: 2019-12-04 20:24:04
44
* @LastEditors: ly525
5-
* @LastEditTime: 2019-12-14 21:46:23
5+
* @LastEditTime: 2019-12-15 16:39:33
66
* @FilePath: /luban-h5/back-end/h5-api/views/engine.ejs
77
* @Github: https://github.com/ly525/luban-h5
88
* @Description: 手机端预览模板
@@ -275,9 +275,18 @@
275275
},
276276
});
277277
278+
function title(str) {
279+
if (str.length <= 1) return str.toUpperCase()
280+
return str.slice(0,1).toUpperCase() + str.slice(1)
281+
}
282+
278283
function displayMessage ({ origin, data }) {
279284
if (['next', 'prev'].includes(data) && origin === window.location.origin) {
280-
document.querySelector(`.swiper-button-${data}`).click()
285+
// 不采用下面的原因:在移动端和小屏幕上,会移除:.swiper-button-prev, .swiper-button-next 按钮
286+
// document.querySelector(`.swiper-button-${data}`).click()
287+
288+
var action = `slide${title(data)}`
289+
mySwiper[action]()
281290
}
282291
}
283292

0 commit comments

Comments
 (0)