请教大家,一个关于vue的这种情况,写法如何去写?谢谢?
<u--input
v-if="item.is_disabled"
type="digit"
@change="goods_price_change($event,index)"
@blur="goods_price_blur($event,index)"
v-model="item.goods_price" placeholder=""
></u--input>
我想在上面的这个input里,再加一个条件判断,is_update_price 这个值如果为true ,就保持上面的原样,如果为false 就增加一个 disabled 属性,也就是下面这样:
<u--input
v-if="item.is_disabled"
type="digit"
@change="goods_price_change($event,index)"
@blur="goods_price_blur($event,index)"
v-model="item.goods_price" placeholder=""
disabled //这是新增的
></u--input>
这种判断不知道怎么去写,想请大家指点下谢谢
回复
1个回答

test
2024-07-16
<u--input
v-if="item.is_disabled"
type="digit"
@change="goods_price_change($event,index)"
@blur="goods_price_blur($event,index)"
v-model="item.goods_price" placeholder=""
:disabled="!is_update_price"
></u--input>
// 如果is_update_price值为false, 则disabled=true
:disabled="!is_update_price"
回复

适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容