【发布时间】:2021-01-14 10:50:04
【问题描述】:
vue js如何只让一个元素激活? 我有3个下拉列表,一次激活3个,如何确保只有一个被激活?
据我了解,这需要通过循环来完成,但是这个框架不是给我的
<tr class="inputs-table">
<td>Type object: </td>
<td>
<div class="select">
<div class="select-header form-control" v-on:click="AddForm">
<span class="select__current">Please select one option</span>
<span class="select__off">х</span>
</div>
<addForm v-if="addedForm" />
</div>
</td>
</tr>
<tr class="inputs-table">
<td>Type business-model: </td>
<td>
<div class="select">
<div class="select-header form-control" v-on:click="AddForm">
<span class="select__current">Please select one option</span>
<span class="select__off">х</span>
</div>
<addForm v-if="addedForm"/>
</div>
</td>
</tr>
import addForm from './modal/addForm.vue';
export default {
name: 'Index',
data() {
return {
addedForm: false
}
},
methods: {
AddForm(){
this.addedForm = true;
},
closeForm() {
this.$parent.addedForm = false;
}
},
components: {
addForm,
}
}
【问题讨论】:
-
你的下拉列表在哪里?
-
prnt.sc/upk2oe 他来了
-
您似乎没有使用组件库,因此很难识别您提到的组件是什么,例如下拉菜单在哪里。您能否通过一些屏幕截图更新您的问题。
标签: vue.js vuejs2 vue-component