【发布时间】:2020-07-15 16:47:01
【问题描述】:
这是我的代码:
<input
v-model="comb.inactive"
type="checkbox"
@click="setInactive(comb.id_base_product_combination)"
>
我需要在 v-model 上应用 comb.inactive 的反转。
这是我尝试过的:
<input
v-model="comb.inactive == 1 ? 0 : 1"
type="checkbox"
@click="setInactive(comb.id_base_product_combination)"
>
<input
v-model="comb.inactive == 1 ? false : true"
type="checkbox"
@click="setInactive(comb.id_base_product_combination)"
>
你有其他想法吗?
【问题讨论】:
-
“你有其他想法吗?”是的,使用 Vue 计算。这不值得回答,而是更深入地了解 Vue
标签: javascript vue.js boolean v-model