提交 4c20d30a 编写于 作者: 杜庆泉's avatar 杜庆泉

swiper 示例增加 current-id场景

上级 c3125a87
...@@ -53,16 +53,29 @@ describe('test swiper', () => { ...@@ -53,16 +53,29 @@ describe('test swiper', () => {
}); });
it('check loop index', async () => { it('check current', async () => {
await page.setData({ await page.setData({
currentVal: 2, currentVal: 2,
}) })
await page.waitFor(1600) await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(2) expect(await getData('currentValChange')).toEqual(2)
await page.setData({ await page.setData({
currentVal: 0, currentVal: 0,
}) })
await page.waitFor(1600) await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(0)
});
it('check currentId', async () => {
await page.setData({
currentItemIdVal: 'C',
})
await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(2)
await page.setData({
currentItemIdVal: 'A',
})
await page.waitFor(600)
expect(await getData('currentValChange')).toEqual(0) expect(await getData('currentValChange')).toEqual(0)
}); });
......
...@@ -106,10 +106,11 @@ ...@@ -106,10 +106,11 @@
currentValChange:0 currentValChange:0
} }
}, },
methods: { methods: {
swiperChange: function (e : SwiperChangeEvent) { swiperChange: function (e : SwiperChangeEvent) {
this.currentValChange = e.detail.current this.currentValChange = e.detail.current
console.log(this.currentValChange)
if (this.swiperChangeSelect) { if (this.swiperChangeSelect) {
console.log("swiperChange") console.log("swiperChange")
console.log(e) console.log(e)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册