按照文档在App.vue文件的onLaunch方法中获取manife.json的appid等信息
<script>
export default {
onLaunch: function () {
console.log('App Launch');
console.log('1231312',plus.runtime.appid)
},
onShow: function () {
console.log('App Show');
},
onHide: function () {
console.log('App Hide');
}
}
</script>
可是运行的时候js报错
index.umd.min.js:1 [system] ReferenceError: plus is not defined
at Vue.onLaunch (App.vue:6)
at invokeWithErrorHandling (vue.runtime.esm.js:1859)
at Vue../node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js.Vue.__call_hook (vue.runtime.esm.js:8529)
at a (index.umd.min.js:1)
at Vue.mounted (index.umd.min.js:1)
at invokeWithErrorHandling (vue.runtime.esm.js:1859)
at callHook (vue.runtime.esm.js:4223)
at mountComponent (vue.runtime.esm.js:4090)
at Vue../node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js.Vue.$mount (vue.runtime.esm.js:8545)
at Object.../../../../phpstudy_pro/WWW/xboa/xbapp/main.js (main.js:38)
请问是什么原因呢 正确的处理方式是什么
也试过将获取appid的代码移动到其他的页面里也是会提示not defined
0 个回复