Subscribe on changes!

v-if 当值为函数且结果为 Ref 类型就必为 true,这是不是 bug?

avatar
Jan 20th 2022

Version

3.2.27

Reproduction link

sfc.vuejs.org/

Steps to reproduce

打开链接可重现

What is expected?

v-if 那个是 false, 应该不显示内容

What is actually happening?

显示了内容


是设计如此,需要自己判断还是未完成?

avatar
Jan 20th 2022

() => shown returns a ref so it's truthy. You need to access the value via shown.value. Only those refs which are directly exposed to the template, or inside reactive object will be unwrapped automatically.