<Card v-for="item in ftdata" v-if="item"> <Row> <i-col span="6">病症信息{{item}}</i-col> <i-col span="12"> <RadioGroup v-model="redioSelect" :on-change="radioChange()"> <Radio label="china"> <span>中医</span> </Radio> <Radio label="west"> <span>西医</span> </Radio> </RadioGroup> </i-col> <i-col span="6"> <Button type="error" size="small" @click="deletethisOne(item)">删除</Button></i-col> </Row> <Row style="margin-top: 10px"> <i-col span="6">病症类型</i-col> <i-col span="16"> <i-select> <option v-for="it in ftdata1" :value=it.id>{{it.name}}</option> </i-select> </i-col> </Row> <Row style="margin-top: 10px"> <i-col span="6">具体病名</i-col> <i-col span="16"> <i-select> <option value="0">肺病</option> <option value="0">心脑病</option> </i-select> </i-col> </Row> <Row style="margin-top: 10px"> <i-col span="6">选择病症 </i-col> <i-col span="16"> <i-select> <option value="0">肺病</option> <option value="0">心脑病</option> </i-select> </i-col> </Row> <Row style="margin-top: 10px"> <i-col span="6">附加说明 </i-col> <i-col span="16"> <i-input type="textarea"></i-input> </i-col> </Row> </Card>
method中的方法
queryDiseaseType(type){ if(type==null){ this.$Message.error("为传入类型") return; } this.$axios.post(_config.serverpath+"common/getParentDisease",{ type:type, }).then(data=>{ this.ftdata1 = data.data.data[0]; console.log(data) }) }, diseaseTypechange(){}, querySondis(){ }, radioChange(){ console.log(this.ftdata) let Redio = this.redioSelect; if(Redio=='west'){ this.queryDiseaseType(2) }else if (Redio=='china'){ this.queryDiseaseType(1) } }, addOneMessage(){ this.i = this.i+1; this.ftdata.push(this.i) }, deletethisOne(a){ console.log(this.index); console.log(a); let index = this.ftdata.indexOf(a) if (index > -1) { this.ftdata.splice(index, 1); if(this.ftdata.length==0){ this.i = 0; } } }
很神奇的bug,只要一触发Redio的change事件,他就会进行一个死循环。
有没有大佬给看一下为什么