feat(banner管理页面): 搜索栏“国家”选项调整
This commit is contained in:
parent
e0def280bd
commit
7cdf310aa9
@ -310,7 +310,7 @@ export default {
|
||||
textOptTitle: "",
|
||||
listLoading: true,
|
||||
|
||||
selectedCountry: {},
|
||||
selectedCountry: {}, // 存储完整的国家对象
|
||||
countryList: [],
|
||||
loadingCountry: false
|
||||
};
|
||||
@ -381,10 +381,21 @@ export default {
|
||||
const that = this;
|
||||
console.log("val", val);
|
||||
|
||||
that.selectedCountry = this.countryList.filter(
|
||||
item => item.country.alphaTwo === val
|
||||
)[0];
|
||||
that.listQuery.countryCode = this.selectedCountry.country.alphaTwo;
|
||||
if (!val) {
|
||||
// 如果没有选择国家,清空相关字段
|
||||
that.listQuery.countryCode = "";
|
||||
that.selectedCountry = {};
|
||||
} else {
|
||||
// 选择了一个国家
|
||||
that.selectedCountry =
|
||||
this.countryList.find(item => item.country.alphaTwo === val) || {};
|
||||
|
||||
// 使用传统的方式访问嵌套属性
|
||||
that.listQuery.countryCode = that.selectedCountry.country
|
||||
? that.selectedCountry.country.alphaTwo
|
||||
: "";
|
||||
}
|
||||
|
||||
this.renderData();
|
||||
},
|
||||
|
||||
@ -397,7 +408,8 @@ export default {
|
||||
.then(res => {
|
||||
that.loadingCountry = false;
|
||||
that.countryList = res.body || [];
|
||||
that.listQuery.countryCode = that.selectedCountry.country.alphaTwo;
|
||||
that.listQuery.countryCode = "";
|
||||
that.selectedCountry = {};
|
||||
// that.renderData();
|
||||
})
|
||||
.catch(er => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user