vue3 toRaw is not defined
时间: 2023-07-18 19:40:15 浏览: 220
解决vue项目报错webpackJsonp is not defined问题
5星 · 资源好评率100%
`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.
阅读全文