vue3 toRaw is not defined
时间: 2023-07-18 07:40:15 浏览: 233
Vue3 Project 项目(01) 源码
`toRaw` is a new function introduced in Vue 3's `@vue/reactivity` package. You need to import it first before using it.
Here's an example:
```js
import { reactive, toRaw } from 'vue';
const original = { foo: 'bar' };
const observed = reactive(original);
const raw = toRaw(observed); // returns the original object
console.log(raw === original); // true
```
Make sure that you have installed the `@vue/reactivity` package and imported `toRaw` from it.
阅读全文