[new feature] Tab support sticky (#382)

This commit is contained in:
neverland
2017-12-06 14:19:08 +08:00
committed by GitHub
parent beb3ed141d
commit 80c2fdc18f
7 changed files with 148 additions and 33 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
<template>
<van-tabs :active="active" :duration="duration" @click="handleTabClick" @disabled="handleTabDisabledClick">
<van-tabs :active="active" :duration="duration" @click="handleTabClick" @disabled="handleTabDisabledClick" :sticky="sticky">
<van-tab :title="firstTabTitle" :disabled="firstTabDisabled">内容一</van-tab>
<van-tab title="选项二">内容二</van-tab>
<van-tab title="选项三" disabled>内容三</van-tab>
@@ -24,7 +24,8 @@ export default {
},
firstTabDisabled: {
type: Boolean
}
},
sticky: Boolean
},
data() {
+16
View File
@@ -113,4 +113,20 @@ describe('Tabs', () => {
done();
});
});
it('sticky', (done) => {
wrapper = mount(TabsTestComponent, {
attachToDocument: true,
propsData: {
sticky: true
}
});
wrapper.vm.sticky = false;
setTimeout(() => {
expect(wrapper.vm.$children[0].fixed).to.be.false;
done();
}, 30);
});
});