Subscribe on changes!

函数里面返回一个computed计算后的值,在模板渲染时字符串会多出双引号

avatar
Jan 15th 2022

Version

3.2.25

Reproduction link

sfc.vuejs.org/

Steps to reproduce

直接访问重现链接即可

What is expected?

模板上不要出现双引号

What is actually happening?

模板上出现了双引号


模板上使用数据时加上value没问题

avatar
Jan 15th 2022

Your fn is not returning a reactive object so Vue won't automatically unwrap the internal computed refs. You are seeing double quotes as it's the result of stringifying a ref object.