[bugfix] Area: should not display city & county list when not select province (#560)

This commit is contained in:
neverland 2018-01-22 16:20:16 +08:00 committed by GitHub
parent 91872a3101
commit e7720506ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,17 +94,16 @@ export default create({
// `code`
getList(type, code) {
if (!this.listValid) {
return [];
}
let result = [];
if (this.listValid && (type === 'province' || code)) {
const { areaList } = this;
const list =
type === 'province'
? areaList.province_list
: type === 'city' ? areaList.city_list : areaList.county_list;
let result = Object.keys(list).map(code => ({
result = Object.keys(list).map(code => ({
code,
name: list[code]
}));
@ -112,6 +111,7 @@ export default create({
if (type !== 'province' && code) {
result = result.filter(item => item.code.indexOf(code) === 0);
}
}
result.unshift({
code: '-1',