提交 e47fc12d 编写于 作者: D DCloud_LXH

feat(h5): getLaunchOptionsSync、getEnterOptionsSync

上级 15fd2049
......@@ -10,6 +10,29 @@ export {
}
from './create-app'
export let createLaunchOptions = function () {
const scene = 1001
const referrerInfo = {
appId: '',
extraData: {},
}
try {
return {
path: this.$route.meta && this.$route.meta.pagePath,
query: this.$route.query,
scene,
referrerInfo
}
} catch (error) {
return {
path: '',
query: {},
scene,
referrerInfo
}
}
}
export function createAppMixin (Vue, routes, entryRoute) {
return {
created: function AppCreated () {
......@@ -31,13 +54,10 @@ export function createAppMixin (Vue, routes, entryRoute) {
},
mounted: function appMounted () {
// 稍微靠后点,让 App 有机会在 mounted 事件前注册一些全局事件监听,如 UI 显示(showModal)
const args = {
path: this.$route.meta && this.$route.meta.pagePath,
query: this.$route.query,
scene: 1001
}
createLaunchOptions = createLaunchOptions.bind(this)
const args = createLaunchOptions()
callAppHook(this, 'onLaunch', args)
callAppHook(this, 'onShow', args)
}
}
}
}
import {
createLaunchOptions
} from 'uni-core/service/plugins/app'
export function getLaunchOptionsSync () {
return createLaunchOptions()
}
export function getEnterOptionsSync () {
return createLaunchOptions()
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册