`Ref` value returned by function won't get unwrapped
Version
3.2.31
Reproduction link
Steps to reproduce
- refer a
Ref
value returned by a function in<template>
- confirm that the returned value won't get unwrapped automatically
What is expected?
expect this will work.
<template>
<pre v-html="getVal()"></pre>
</template>
What is actually happening?
I have to unwrap the value myself:
<template>
<pre v-html="getVal().value"></pre>
</template>
x
Yes, this is expected. See https://vuejs.org/guide/essentials/reactivity-fundamentals.html#ref-unwrapping-in-templates
Hi @posva @caozhong1996 I have read the doc page you provided. But I couldn't see why this is expected. What's the reason for this?
Hi @posva @caozhong1996 I have read the doc page you provided. But I couldn't see why this is expected. What's the reason for this?
Unwrapping occurs in the compilation phase,Unable to process return value of function.