子组件给父组件传值:
在子组件方法里面写
this.$emit("seldrop", e);
在父组件里面写:
html里面写
<div
style="margin-right:15px;"
:class="this.select == 4 ? 'showBorder' : ''"
>
<DropdownBoxA
:message="options4"
@seldrop="_seldrop($event, options4, 4)"
:value="options4.value"
></DropdownBoxA>
</div>
_seldrop(e, opt, ind) {
// this.options1.value = this.options1.oval
//重置所有选项
this.options2.value = this.options2.oval;
this.options3.value = this.options3.oval;
this.options4.value = this.options4.oval;
this.select = ind;
opt.value = e.label;
每当调用这个方法时候,将他们的value值全部用oval覆盖,然后选择的值label值再覆盖oval的值。
然后是:class,写成动态的渲染样式,如果满足条件就渲染