mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(area): columns-placeholder prop rendering error (#12857)
Co-authored-by: yipl <yipl@dustess.com> Co-authored-by: neverland <jait.chen@foxmail.com>
This commit is contained in:
parent
c0eff77e9b
commit
db1adf61bc
@ -113,7 +113,7 @@ export default {
|
|||||||
<van-area
|
<van-area
|
||||||
title="Title"
|
title="Title"
|
||||||
:area-list="areaList"
|
:area-list="areaList"
|
||||||
:columns-placeholder="['Choose', 'Choose', 'Choose']"
|
:columns-placeholder="['Province', 'City', 'County']"
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ export default {
|
|||||||
<van-area
|
<van-area
|
||||||
title="标题"
|
title="标题"
|
||||||
:area-list="areaList"
|
:area-list="areaList"
|
||||||
:columns-placeholder="['请选择', '请选择', '请选择']"
|
:columns-placeholder="['省份', '城市', '区县']"
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@ const t = useTranslate({
|
|||||||
title2: '控制选中项',
|
title2: '控制选中项',
|
||||||
title3: '配置显示列',
|
title3: '配置显示列',
|
||||||
title4: '配置列占位提示文字',
|
title4: '配置列占位提示文字',
|
||||||
columnsPlaceholder: ['请选择', '请选择', '请选择'],
|
columnsPlaceholder: ['省份', '城市', '区县'],
|
||||||
areaList,
|
areaList,
|
||||||
},
|
},
|
||||||
'en-US': {
|
'en-US': {
|
||||||
title2: 'Model Value',
|
title2: 'Model Value',
|
||||||
title3: 'Columns Number',
|
title3: 'Columns Number',
|
||||||
title4: 'Columns Placeholder',
|
title4: 'Columns Placeholder',
|
||||||
columnsPlaceholder: ['Choose', 'Choose', 'Choose'],
|
columnsPlaceholder: ['Province', 'City', 'County'],
|
||||||
areaList: areaListEn,
|
areaList: areaListEn,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -535,7 +535,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item van-picker-column__item--selected"
|
class="van-picker-column__item van-picker-column__item--selected"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Choose
|
Province
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
@ -583,7 +583,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item van-picker-column__item--selected"
|
class="van-picker-column__item van-picker-column__item--selected"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Choose
|
City
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -601,7 +601,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item van-picker-column__item--selected"
|
class="van-picker-column__item van-picker-column__item--selected"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Choose
|
County
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -510,7 +510,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item van-picker-column__item--selected"
|
class="van-picker-column__item van-picker-column__item--selected"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Choose
|
Province
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
@ -557,7 +557,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item van-picker-column__item--selected"
|
class="van-picker-column__item van-picker-column__item--selected"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Choose
|
City
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -574,7 +574,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item van-picker-column__item--selected"
|
class="van-picker-column__item van-picker-column__item--selected"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Choose
|
County
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -7,6 +7,24 @@ import {
|
|||||||
PickerConfirmEventParams,
|
PickerConfirmEventParams,
|
||||||
} from '../../picker';
|
} from '../../picker';
|
||||||
|
|
||||||
|
test('should columns placeholder displayed normally', async () => {
|
||||||
|
const columnsPlaceholder = ['Province', 'City', 'County'];
|
||||||
|
|
||||||
|
const wrapper = mount(Area, {
|
||||||
|
props: {
|
||||||
|
areaList,
|
||||||
|
columnsPlaceholder,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const columns = await wrapper.findAll('.van-picker-column');
|
||||||
|
await columns[0].findAll('li')?.[1].trigger('click');
|
||||||
|
expect(columns[1].find('li').text()).toBe(columnsPlaceholder[1]);
|
||||||
|
|
||||||
|
await columns[1].findAll('li')?.[1].trigger('click');
|
||||||
|
expect(columns[2].find('li').text()).toBe(columnsPlaceholder[2]);
|
||||||
|
});
|
||||||
|
|
||||||
test('should emit confirm event after click the confirm button', async () => {
|
test('should emit confirm event after click the confirm button', async () => {
|
||||||
const wrapper = mount(Area, {
|
const wrapper = mount(Area, {
|
||||||
props: {
|
props: {
|
||||||
|
@ -47,10 +47,10 @@ export function formatDataForCascade({
|
|||||||
|
|
||||||
const getProvinceChildren = () => {
|
const getProvinceChildren = () => {
|
||||||
if (showCity) {
|
if (showCity) {
|
||||||
return placeholder.length
|
return placeholder.length > 1
|
||||||
? [
|
? [
|
||||||
makeOption(
|
makeOption(
|
||||||
placeholder[0],
|
placeholder[1],
|
||||||
AREA_EMPTY_CODE,
|
AREA_EMPTY_CODE,
|
||||||
showCounty ? [] : undefined,
|
showCounty ? [] : undefined,
|
||||||
),
|
),
|
||||||
@ -71,7 +71,7 @@ export function formatDataForCascade({
|
|||||||
if (showCity) {
|
if (showCity) {
|
||||||
const getCityChildren = () => {
|
const getCityChildren = () => {
|
||||||
if (showCounty) {
|
if (showCounty) {
|
||||||
return placeholder.length ? [makeOption(placeholder[1])] : [];
|
return placeholder.length > 2 ? [makeOption(placeholder[2])] : [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user