创建下拉框:
<div id="chart-shopname" class="chart-shopname">
<select v-model="selected" @change="changeShop">
<option disabled value="">请选择</option>
<option v-for="(store,index) in secondSummary.t0RealtimeStoreList" :value="store.shopName">{{store.shopName}}</option>
</select>
</div>
点击相应选项,出现相应数据,试了用watch监听,然后发现一种更简单的方法
changeShop(){ this.secondSummary.t0RealtimeStoreList.forEach(item=>{ if(this.selected === item.shopName){ this.secondSummary20 = item.totalTop20Prod; } }) },
直接用if 判断selected,然后调用