Subscribe on changes!

`Ref` value returned by function won't get unwrapped

avatar
Feb 23rd 2022

Version

3.2.31

Reproduction link

codesandbox.io

Steps to reproduce

  1. refer a Ref value returned by a function in <template>
  2. 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

avatar
Feb 23rd 2022

I would say it's expected.

avatar
Feb 24th 2022

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?

avatar
Feb 24th 2022

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.

avatar
Feb 24th 2022

@ygj6 Got it, thanks!