9***@qq.com
9***@qq.com
  • 发布:2020-02-18 13:29
  • 更新:2020-02-18 13:29
  • 阅读:1019

getCurrentPages无法正确获取options

分类:uni-app

我将获取页面数据的方法在main.js中简单封装,然后挂在全局,是这样写的

const curParams = () => {  
    const currentPage = getCurrentPages().pop()  
    console.log(currentPage)  
    console.log(Object.keys(currentPage))  
    const currentParams = currentPage.options  
    console.log(currentParams)  
    return currentParams  
}

然后在调用这个方法时

展开后可以在第一个console中看到options,但是在Object.keys的遍历中却没有这一项,导致后面的获取出现错误,这是为什么?

2020-02-18 13:29 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复