mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-25 15:59:16 +08:00
fix(Area): allow to reset modelValue
This commit is contained in:
parent
5900affe37
commit
8d49b88748
@ -66,16 +66,20 @@ export default defineComponent({
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newCode) => {
|
||||
if (newCode) {
|
||||
const lastCode = codes.value.length
|
||||
? codes.value[codes.value.length - 1]
|
||||
: '';
|
||||
if (newCode && newCode !== lastCode) {
|
||||
if (newCode !== lastCode) {
|
||||
codes.value = [
|
||||
`${newCode.slice(0, 2)}0000`,
|
||||
`${newCode.slice(0, 4)}00`,
|
||||
newCode,
|
||||
].slice(0, +props.columnsNum);
|
||||
}
|
||||
} else {
|
||||
codes.value = [];
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
@ -38,9 +38,9 @@ export function formatDataForCascade({
|
||||
columnsPlaceholder: placeholder,
|
||||
}: AreaProps) {
|
||||
const {
|
||||
city_list: city,
|
||||
county_list: county,
|
||||
province_list: province,
|
||||
city_list: city = {},
|
||||
county_list: county = {},
|
||||
province_list: province = {},
|
||||
} = areaList;
|
||||
const showCity = columnsNum > 1;
|
||||
const showCounty = columnsNum > 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user