mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Area: should support set columns-num dynamically
This commit is contained in:
parent
27b784d2ec
commit
cf3b797b20
@ -54,6 +54,12 @@ export default sfc({
|
|||||||
handler() {
|
handler() {
|
||||||
this.setValues();
|
this.setValues();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
columnsNum() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.setValues();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -96,6 +96,32 @@ exports[`change option 3`] = `
|
|||||||
</div>
|
</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`] = `
|
exports[`reset method 1`] = `
|
||||||
<div class="van-picker van-area">
|
<div class="van-picker van-area">
|
||||||
<div class="van-hairline--top-bottom van-picker__toolbar">
|
<div class="van-hairline--top-bottom van-picker__toolbar">
|
||||||
|
@ -106,3 +106,19 @@ test('reset method', async () => {
|
|||||||
wrapper.vm.reset();
|
wrapper.vm.reset();
|
||||||
expect(wrapper).toMatchSnapshot();
|
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();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user