Commit 3eab11954217826b1398c4a1d1aababc8b907f21

Authored by ly525
1 parent ef1278ed

fix(engine): click the next or prev not working; (zh) 修正预览弹窗中,点击上一页和下一页失败的问题

back-end/h5-api/views/engine.ejs
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2019-12-04 20:24:04 3 * @Date: 2019-12-04 20:24:04
4 * @LastEditors: ly525 4 * @LastEditors: ly525
5 - * @LastEditTime: 2019-12-14 21:46:23 5 + * @LastEditTime: 2019-12-15 16:39:33
6 * @FilePath: /luban-h5/back-end/h5-api/views/engine.ejs 6 * @FilePath: /luban-h5/back-end/h5-api/views/engine.ejs
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: 手机端预览模板 8 * @Description: 手机端预览模板
@@ -275,9 +275,18 @@ @@ -275,9 +275,18 @@
275 }, 275 },
276 }); 276 });
277 277
  278 + function title(str) {
  279 + if (str.length <= 1) return str.toUpperCase()
  280 + return str.slice(0,1).toUpperCase() + str.slice(1)
  281 + }
  282 +
278 function displayMessage ({ origin, data }) { 283 function displayMessage ({ origin, data }) {
279 if (['next', 'prev'].includes(data) && origin === window.location.origin) { 284 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]()
281 } 290 }
282 } 291 }
283 292