1、(1)下拉框change事件,默认值为空,
(2)filterOption将输入的内容与显示的内容进行匹配,
(3)popupScroll是滚动事件,
(4)在data中定义userList为数组,在created中定义方法,在方法中获取下拉框的数据
<div class="tips-wrapper1 ">
<a-select
placeholder="请选择"
@change="userSelect"
class="tipWrapperSelect"
default-value=""
:size="size"
showSearch
:filterOption="filterOption"
@popupScroll="popupScroll"
>
<a-select-option value="">全部</a-select-option>
<a-select-option v-for="(item, index) in userList" :key="index" :value="item.userId">
{{ item.Companyname }}
</a-select-option>
</a-select>
</div>
2、在data中定义selectValue ,把value赋值给this.selectValue .调echarts的相关方法
// 下拉框选择点击
userSelect(value) {
this.selectValue = value
this.showEchart()
this.initData()
},
3、将输入的内容与显示的内容进行匹配
filterOption(value, option) {
return option.componentOptions.children[0].text.indexOf(value) >= 0
},
4、滚动事件
popupScroll() {}
5、获取下拉选择框数据
getUserList() {
getUserList({cationStatus: 1}).then(res => {
this.userList = res.rows
this.defaultId = this.userList[0].userId
})
},