vue下拉框和输入框的联动

基于element-UI的下拉框


【vue下拉框和输入框的联动】通过change事件,进行联动,temp为当前下拉框内值,遍历company内的值,赋值与name对应的Id
companyChange (temp) { console.log(temp) this.companyName.forEach(element => { if (element.insuranceCompanyName === temp) { this.formData.insuranceCompanyId = element.insuranceCompanyId } }) },

从数据库中取得集合
let _data = https://www.it610.com/article/{} this.$http.post(this.API.getCompanyName, _data).then((response) => { this.companyName = response.data.data }).catch((response) => { console.log(response) this.$message.error('网络异常') })

    推荐阅读