关于getCurrentInstance

来源:10-6 vue3+vue-router使用方法

LoveFen

2021-05-24

getCurrentInstance 下没有route

    const {ctx} = getCurrentInstance()
    console.log(ctx.$router) //undefined

图片描述

写回答

2回答

fengyunzhu

2021-12-04

getCurrentInstance().appContext.config.globalProperties 可以获取到 route

生产模式下请不要使用 getCurrentInstance()

0
0

扬_灵

2021-06-07

同学你好,可以把你的项目代码上传到github或是码云这些代码托管平台,把地址发我一下,我在本地帮你测试定位一下问题。

0
0

数据可视化入门到精通-打造前端差异化竞争力

同级别前端,掌握数据可视化薪资更高

1520 学习 · 1043 问题

查看课程