我在将国家/地区字段中的选定值继承到活动字段时遇到了一些麻烦。
我有 2 个子组件(国家和活动),它们都使用 Vue-multiselect。
我country
用作广告系列组件的道具,因为广告系列中的列表取决于用户选择的国家/地区。
这是我的主要字段形式:
<Country
:load-data="form.country"
v-on:country-select="countrySelected"
v-on:country-remove="countryRemove">
</Country>
<Campaign
:load-data="form.campaign"
:country="countrySelected"
v-on:campaign-select="CampaignSelected"
v-on:campaign-remove="CampaignRemove">
</Campaign>
这是我的广告系列子组件:
<multiselect
tag-placeholder="Add this as new campaign name"
placeholder="Search or add a campaign name"
v-model="value"
:options="options"
label="name"
track-by="id"
:multiple="true"
:taggable="true"
:disabled="this.disabled"
@select="selected"
@remove="remove">
</multiselect>
我声明country
为道具的地方:
props:
{
country:''
},
和获得活动的方法:
TableFilterService.getCampaignNames()
.then((response) => {
this.options = response;
})
.catch((error) => {
console.error(error);
});
广告系列样本数据:
data:
{
au :
{
id : '1111',
name: 'ddddd'
}
}