[bugfix] Area: should support set columns-num dynamically

This commit is contained in:
陈嘉涵 2019-06-03 11:06:27 +08:00
parent 7f4128a067
commit 6e4b82249b
3 changed files with 48 additions and 0 deletions

View File

@ -54,6 +54,12 @@ export default sfc({
handler() {
this.setValues();
}
},
columnsNum() {
this.$nextTick(() => {
this.setValues();
});
}
},

View File

@ -93,6 +93,32 @@ exports[`change option 3`] = `
</div>
`;
exports[`columns-num prop 1`] = `
<div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar">
<div role="button" tabindex="0" class="van-picker__cancel">取消</div>
<div role="button" tabindex="0" class="van-picker__confirm">确认</div>
</div>
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column">
<ul class="van-picker-column__wrapper" style="transform: translate3d(0, 88px, 0); transition-duration: 0ms; transition-property: none; line-height: 44px;">
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
</ul>
</div>
<div class="van-picker-column">
<ul class="van-picker-column__wrapper" style="transform: translate3d(0, 88px, 0); transition-duration: 0ms; transition-property: none; line-height: 44px;">
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul>
</div>
<div class="van-picker__mask" style="background-size: 100% 88px;"></div>
<div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div>
</div>
</div>
`;
exports[`reset method 1`] = `
<div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar">

View File

@ -101,3 +101,19 @@ test('reset method', async () => {
wrapper.vm.reset();
expect(wrapper).toMatchSnapshot();
});
test('columns-num prop', async () => {
const wrapper = mount(Area, {
propsData: {
areaList,
columnsNum: 3
}
});
wrapper.setProps({
columnsNum: 2
});
await later();
expect(wrapper).toMatchSnapshot();
});