我从api获得options.customerdata.showbutton的值为true,所以现在开关是在条件上。我希望开关处于关闭状态,因此应给出v-model =“ false”。但尝试给v-model =“!(options.customerdata.showbutton)”无效,并显示错误。如何实现这一目标?
<b-form-checkbox v-model="options.customerdata.showbutton" name="logo-display" switch >
</b-form-checkbox>
模型不能为表达式(必须引用属性)
最简单的方法是定义数据并将其设置为负值。
data: {
return {
show: !this.options.customerdata.showbutton
}
}