cklwblove / blog

记录日常遇到的bug
1 stars 0 forks source link

vconsole 问题 #35

Open cklwblove opened 5 years ago

cklwblove commented 5 years ago

问题描述:

[Vue warn]: Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

原因:

解决办法:

function vueRouteObjectCopy (route: Route): Route {
    let _route: any = {}

    for (let i in route) {
        if (typeof route[i] === 'object') {
            if (i === 'matched') {
                _route[i] = [] // 'from.matched' is circular objects, need deep copying, recommended not to print this property
            } else {
                _route[i] = Object.assign({}, route[i])
            }
        } else {
            _route[i] = route[i] || ''
        }
    }

    return _route
}

参考:https://github.com/Tencent/vConsole/issues/152

cklwblove commented 4 years ago

当页面数据量比较大时,vConsole 有的时候也会导致移动端页面卡死现象