We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.7.14
codesandbox.io
Vue 2.7.14 CodeSandbox
https://codesandbox.io/s/recursing-tree-kfpd6x?file=/src/App.vue
Vue 3 CodeSandbox
https://codesandbox.io/s/charming-paper-b4u9qy?file=/src/App.vue
相同的代码。
在Vue 2.7.14 渲染结果
aHook.loading: { "value": false }
在Vue 3 渲染结果
aHook.loading: true
<template> <div> <div>aHook.loading: {{ aHook.loading }}</div> <!-- vue 2.7.14: aHook.loading: { "value": false } --> <!-- vue 3: aHook.loading: true --> <div>loading:{{ loading }}</div> <button @click="clickBtn1">clickBtn1</button> </div> </template> <script> import { defineComponent, reactive, toRefs } from 'vue'; export default defineComponent({ setup() { function useAHook() { const state = reactive({ loading: false, }); return { ...toRefs(state), fn() { state.loading = true; }, }; } const aHook = useAHook(); const { loading } = aHook; function clickBtn1() { aHook.fn(); } return { aHook, loading, clickBtn1, }; }, }); </script>
在Vue 2.7.14 渲染结果与 Vue 3 相同。 渲染内容为:aHook.loading: true
渲染内容为:aHook.loading: { "value": false }
The text was updated successfully, but these errors were encountered:
It looks like the toString should unref the Ref<T> object
Ref<T>
This maybe due to Vue 2's reactivity limitations.
Vue 3 has a replacer parameter in JSON.stringify that call in toDisplayString but here has not same thing
JSON.stringify
Sorry, something went wrong.
fix: toString util should unref the Ref<T>`
4eddf9d
fix vuejs#12884
fix: toString util should unref the Ref<T>
2a81e39
ae3e4b1
Successfully merging a pull request may close this issue.
Version
2.7.14
Reproduction link
codesandbox.io
Steps to reproduce
Vue 2.7.14 CodeSandbox
https://codesandbox.io/s/recursing-tree-kfpd6x?file=/src/App.vue
Vue 3 CodeSandbox
https://codesandbox.io/s/charming-paper-b4u9qy?file=/src/App.vue
相同的代码。
在Vue 2.7.14 渲染结果
在Vue 3 渲染结果
What is expected?
在Vue 2.7.14 渲染结果与 Vue 3 相同。
渲染内容为:aHook.loading: true
What is actually happening?
渲染内容为:aHook.loading: { "value": false }
The text was updated successfully, but these errors were encountered: