ant-design-vue a-select 无法直接获取value
为什么handleSearch, handleSearchChange, fetchGroupData无法取到data定义里的groupName?
<template>
<div class="table-page-search-wrapper">
<a-select
showSearch
:value="groupName"
placeholder="请输入 主账号名称"
style="width: 400px"
:defaultActiveFirstOption="false"
:showArrow="false"
:filterOption="false"
@search="handleSearch"
@change="handleSearchChange"
:allowClear="true"
:notFoundContent="null"
>
<a-select-option v-for="d in groupDatas" :key="d.value">{{d.text}}</a-select-option>
</a-select>
</div>
</template>
<script>
// from @/views/list/TableInnerEditList
import debounce from 'lodash/debounce'
export default {
name: 'TableList',
data () {
return {
groupName: '',
groupDatas: []
}
},
created () {
this.debouncedGetGroup = debounce(this.fetchGroupData, 700)
},
methods: {
handleSearch (value) {
console.log('handleSearch', this.groupName)
this.debouncedGetGroup()
},
handleSearchChange (value) {
console.log('handleSearchChange', this.groupName)
console.log('handleSearchChange', value)
},
fetchGroupData () {
console.log('fetchGroupData', this.groupName)
const _that = this
_that.$axios.get(`/groups?name=${_that.groupName}&page_size=10`)
.then((d) => {
console.log(d)
const result = d.data
_that.groupDatas = []
result.forEach((r) => {
console.log(r)
_that.groupDatas.push({
value: r.id,
text: r.name
})
})
})
}
}
}
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
去掉
:value="groupName"
试试