Skip to content

uni-app 打包H5时,this.$root.$mp.query 这样的传参无法接收 #227

Closed
@zxzhgk

Description

问题描述
uni-app 打包H5时,this.$root.$mp.query 这样的传参无法接收

复现步骤
[或者可以直接贴源代码]
代码:
this.$root.$mp.query
错误:
index.umd.min.js:1 [system] errorHandler TypeError: Cannot read property 'query' of undefined
at VueComponent.onLoad (main.vue:502)
at a (index.umd.min.js:1)
at s (index.umd.min.js:1)
at VueComponent.created (index.umd.min.js:1)
at callHook (vue.runtime.esm.js:2968)
at VueComponent.Vue._init (vue.runtime.esm.js:4710)
at new VueComponent (vue.runtime.esm.js:4876)
at createComponentInstanceForVnode (vue.runtime.esm.js:4376)
at init (vue.runtime.esm.js:4203)
at createComponent (vue.runtime.esm.js:5686) VueComponent {_uid: 19, _isVue: true, $options: {…}, _renderProxy: Proxy, _self: VueComponent, …} created hook
预期结果
H5版本可以正常使用this.$root.$mp.query 获取到页面的传参

系统信息:

  • 发行平台: [H5平台]
  • 操作系统 [如 iOS 12.1.2、Android 7.0]
  • HBuilderX版本 [如使用HBuilderX,版本号:1.6.2.20190220 ]

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions