fix(Swipe): item should only rendered once (#7466)

This commit is contained in:
neverland
2020-11-01 10:47:09 +08:00
committed by GitHub
parent faefd7ec85
commit 818192c1c8
2 changed files with 15 additions and 13 deletions
+5 -10
View File
@@ -163,6 +163,7 @@ test('lazy-render prop', async () => {
<van-swipe-item><span>2</span></van-swipe-item>
<van-swipe-item><span>3</span></van-swipe-item>
<van-swipe-item><span>4</span></van-swipe-item>
<van-swipe-item><span>5</span></van-swipe-item>
</van-swipe>
`,
data() {
@@ -181,16 +182,13 @@ test('lazy-render prop', async () => {
});
};
expectRender([true, true, false, true]);
expectRender([true, true, false, false, true]);
wrapper.setData({ active: 1 });
expectRender([true, true, true, false]);
expectRender([true, true, true, false, true]);
wrapper.setData({ active: 2 });
expectRender([false, true, true, true]);
wrapper.setData({ active: 3 });
expectRender([true, false, true, true]);
expectRender([true, true, true, true, true]);
});
test('lazy-render prop when loop is false', async () => {
@@ -225,8 +223,5 @@ test('lazy-render prop when loop is false', async () => {
expectRender([true, true, true, false]);
wrapper.setData({ active: 2 });
expectRender([false, true, true, true]);
wrapper.setData({ active: 3 });
expectRender([false, false, true, true]);
expectRender([true, true, true, true]);
});