报错方式
const route = useRoute()
let { query: routeQuery } = JSON.parse(JSON.stringify(route))
// runtime-core.esm-bundler.js:198 [Vue warn]: Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.
报错翻译:避免应用程序逻辑依赖于在组件实例上枚举键。在生产模式下,键值将为空,以避免性能开销
报错原因 可能是深拷贝 js对象序列化(json字符串) 导致route 的一些值 序列化错误 比如route里面的函数 与undefined丢失;
解决
深拷贝具体内容 不深拷贝route整个对象;
let routeQuery = JSON.parse(JSON.stringify(route.query))