提交 966e08fb 编写于 作者: fxy060608's avatar fxy060608

feat(mp): onAppLaunch

上级 e0a90007
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isPromise, isFunction, extend } from '@vue/shared';
import { injectHook } from 'vue';
//App
const ON_LAUNCH = 'onLaunch';
const eventChannels = {};
const eventChannelStack = [];
......@@ -36,6 +40,15 @@ const navigateTo = {
},
};
my.appLaunchHooks = [];
function onAppLaunch(hook) {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return injectHook(ON_LAUNCH, hook, app.$vm.$);
}
my.appLaunchHooks.push(hook);
}
function getBaseSystemInfo() {
return my.getSystemInfoSync()
}
......@@ -722,6 +735,7 @@ const baseApis = {
upx2px,
addInterceptor,
removeInterceptor,
onAppLaunch,
};
function initUni(api, protocols) {
const wrapper = initWrapper(protocols);
......@@ -882,14 +896,14 @@ function createIntersectionObserver(component, options) {
}
var shims = /*#__PURE__*/Object.freeze({
__proto__: null,
getProvider: getProvider,
setStorageSync: setStorageSync,
getStorageSync: getStorageSync,
removeStorageSync: removeStorageSync,
startGyroscope: startGyroscope,
createSelectorQuery: createSelectorQuery,
createIntersectionObserver: createIntersectionObserver
__proto__: null,
getProvider: getProvider,
setStorageSync: setStorageSync,
getStorageSync: getStorageSync,
removeStorageSync: removeStorageSync,
startGyroscope: startGyroscope,
createSelectorQuery: createSelectorQuery,
createIntersectionObserver: createIntersectionObserver
});
function handleNetworkInfo(fromRes, toRes) {
......@@ -1315,58 +1329,58 @@ const chooseAddress = {
};
var protocols = /*#__PURE__*/Object.freeze({
__proto__: null,
returnValue: returnValue,
request: request,
setNavigationBarColor: setNavigationBarColor,
setNavigationBarTitle: setNavigationBarTitle,
showModal: showModal,
showToast: showToast,
showActionSheet: showActionSheet,
showLoading: showLoading,
uploadFile: uploadFile,
downloadFile: downloadFile,
getFileInfo: getFileInfo,
compressImage: compressImage,
chooseVideo: chooseVideo,
connectSocket: connectSocket,
chooseImage: chooseImage,
previewImage: previewImage,
saveFile: saveFile,
getSavedFileInfo: getSavedFileInfo,
getSavedFileList: getSavedFileList,
removeSavedFile: removeSavedFile,
getLocation: getLocation,
openLocation: openLocation,
getNetworkType: getNetworkType,
onNetworkStatusChange: onNetworkStatusChange,
stopAccelerometer: stopAccelerometer,
stopCompass: stopCompass,
scanCode: scanCode,
setClipboardData: setClipboardData,
getClipboardData: getClipboardData,
pageScrollTo: pageScrollTo,
login: login,
getUserInfo: getUserInfo,
requestPayment: requestPayment,
getBLEDeviceServices: getBLEDeviceServices,
createBLEConnection: createBLEConnection,
closeBLEConnection: closeBLEConnection,
onBLEConnectionStateChange: onBLEConnectionStateChange,
makePhoneCall: makePhoneCall,
stopGyroscope: stopGyroscope,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync,
canvasToTempFilePath: canvasToTempFilePath,
setScreenBrightness: setScreenBrightness,
getScreenBrightness: getScreenBrightness,
showShareMenu: showShareMenu,
hideHomeButton: hideHomeButton,
saveImageToPhotosAlbum: saveImageToPhotosAlbum,
saveVideoToPhotosAlbum: saveVideoToPhotosAlbum,
chooseAddress: chooseAddress,
redirectTo: redirectTo,
navigateTo: navigateTo
__proto__: null,
returnValue: returnValue,
request: request,
setNavigationBarColor: setNavigationBarColor,
setNavigationBarTitle: setNavigationBarTitle,
showModal: showModal,
showToast: showToast,
showActionSheet: showActionSheet,
showLoading: showLoading,
uploadFile: uploadFile,
downloadFile: downloadFile,
getFileInfo: getFileInfo,
compressImage: compressImage,
chooseVideo: chooseVideo,
connectSocket: connectSocket,
chooseImage: chooseImage,
previewImage: previewImage,
saveFile: saveFile,
getSavedFileInfo: getSavedFileInfo,
getSavedFileList: getSavedFileList,
removeSavedFile: removeSavedFile,
getLocation: getLocation,
openLocation: openLocation,
getNetworkType: getNetworkType,
onNetworkStatusChange: onNetworkStatusChange,
stopAccelerometer: stopAccelerometer,
stopCompass: stopCompass,
scanCode: scanCode,
setClipboardData: setClipboardData,
getClipboardData: getClipboardData,
pageScrollTo: pageScrollTo,
login: login,
getUserInfo: getUserInfo,
requestPayment: requestPayment,
getBLEDeviceServices: getBLEDeviceServices,
createBLEConnection: createBLEConnection,
closeBLEConnection: closeBLEConnection,
onBLEConnectionStateChange: onBLEConnectionStateChange,
makePhoneCall: makePhoneCall,
stopGyroscope: stopGyroscope,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync,
canvasToTempFilePath: canvasToTempFilePath,
setScreenBrightness: setScreenBrightness,
getScreenBrightness: getScreenBrightness,
showShareMenu: showShareMenu,
hideHomeButton: hideHomeButton,
saveImageToPhotosAlbum: saveImageToPhotosAlbum,
saveVideoToPhotosAlbum: saveVideoToPhotosAlbum,
chooseAddress: chooseAddress,
redirectTo: redirectTo,
navigateTo: navigateTo
});
var index = initUni(shims, protocols);
......
import { isPlainObject, isArray, extend, hyphenate, isObject, hasOwn, toNumber, capitalize, isFunction, NOOP, EMPTY_OBJ, camelize } from '@vue/shared';
import { onUnmounted } from 'vue';
import { onUnmounted, injectHook } from 'vue';
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -476,7 +476,7 @@ function initScopedSlotsParams(instance) {
const vueIds = instance.attrs.vueId;
if (vueIds) {
const vueId = vueIds.split(',')[0];
const object = center[vueId] = center[vueId] || {};
const object = (center[vueId] = center[vueId] || {});
object[name] = value;
if (parents[vueId]) {
parents[vueId].$forceUpdate();
......@@ -542,6 +542,13 @@ function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
findHooks(vueOptions).forEach((hook) => initHook(mpOptions, hook, excludes));
}
my.appLaunchHooks = [];
function injectAppLaunchHooks(appInstance) {
my.appLaunchHooks.forEach((hook) => {
injectHook(ON_LAUNCH, hook, appInstance);
});
}
const HOOKS = [
ON_SHOW,
ON_HIDE,
......@@ -566,7 +573,9 @@ function parseApp(instance, parseAppOptions) {
mpInstance: this,
slots: [],
});
injectAppLaunchHooks(internalInstance);
ctx.globalData = this.globalData;
options.app = this;
instance.$callHook(ON_LAUNCH, options);
},
};
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isPromise, isFunction, extend } from '@vue/shared';
import { injectHook } from 'vue';
//App
const ON_LAUNCH = 'onLaunch';
const eventChannels = {};
const eventChannelStack = [];
......@@ -36,6 +40,15 @@ const navigateTo = {
},
};
swan.appLaunchHooks = [];
function onAppLaunch(hook) {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return injectHook(ON_LAUNCH, hook, app.$vm.$);
}
swan.appLaunchHooks.push(hook);
}
function getBaseSystemInfo() {
return swan.getSystemInfoSync()
}
......@@ -722,6 +735,7 @@ const baseApis = {
upx2px,
addInterceptor,
removeInterceptor,
onAppLaunch,
};
function initUni(api, protocols) {
const wrapper = initWrapper(protocols);
......@@ -847,9 +861,9 @@ function requestPayment(params) {
}
var shims = /*#__PURE__*/Object.freeze({
__proto__: null,
getProvider: getProvider,
requestPayment: requestPayment
__proto__: null,
getProvider: getProvider,
requestPayment: requestPayment
});
function createTodoMethod(contextName, methodName) {
......@@ -922,21 +936,21 @@ const getAccountInfoSync = {
};
var protocols = /*#__PURE__*/Object.freeze({
__proto__: null,
request: request,
connectSocket: connectSocket,
getRecorderManager: getRecorderManager,
getBackgroundAudioManager: getBackgroundAudioManager,
scanCode: scanCode,
navigateToMiniProgram: navigateToMiniProgram,
navigateBackMiniProgram: navigateBackMiniProgram,
showShareMenu: showShareMenu,
getAccountInfoSync: getAccountInfoSync,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
__proto__: null,
request: request,
connectSocket: connectSocket,
getRecorderManager: getRecorderManager,
getBackgroundAudioManager: getBackgroundAudioManager,
scanCode: scanCode,
navigateToMiniProgram: navigateToMiniProgram,
navigateBackMiniProgram: navigateBackMiniProgram,
showShareMenu: showShareMenu,
getAccountInfoSync: getAccountInfoSync,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
});
var index = initUni(shims, protocols);
......
import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared';
import { onUnmounted } from 'vue';
import { onUnmounted, injectHook } from 'vue';
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -501,7 +501,7 @@ function initScopedSlotsParams(instance) {
const vueIds = instance.attrs.vueId;
if (vueIds) {
const vueId = vueIds.split(',')[0];
const object = center[vueId] = center[vueId] || {};
const object = (center[vueId] = center[vueId] || {});
object[name] = value;
if (parents[vueId]) {
parents[vueId].$forceUpdate();
......@@ -567,6 +567,13 @@ function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
findHooks(vueOptions).forEach((hook) => initHook$1(mpOptions, hook, excludes));
}
swan.appLaunchHooks = [];
function injectAppLaunchHooks(appInstance) {
swan.appLaunchHooks.forEach((hook) => {
injectHook(ON_LAUNCH, hook, appInstance);
});
}
const HOOKS = [
ON_SHOW,
ON_HIDE,
......@@ -591,7 +598,9 @@ function parseApp(instance, parseAppOptions) {
mpInstance: this,
slots: [],
});
injectAppLaunchHooks(internalInstance);
ctx.globalData = this.globalData;
options.app = this;
instance.$callHook(ON_LAUNCH, options);
},
};
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isPromise, isFunction, extend } from '@vue/shared';
import { injectHook } from 'vue';
//App
const ON_LAUNCH = 'onLaunch';
const eventChannels = {};
const eventChannelStack = [];
......@@ -36,6 +40,15 @@ const navigateTo = {
},
};
ks.appLaunchHooks = [];
function onAppLaunch(hook) {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return injectHook(ON_LAUNCH, hook, app.$vm.$);
}
ks.appLaunchHooks.push(hook);
}
function getBaseSystemInfo() {
return ks.getSystemInfoSync()
}
......@@ -722,6 +735,7 @@ const baseApis = {
upx2px,
addInterceptor,
removeInterceptor,
onAppLaunch,
};
function initUni(api, protocols) {
const wrapper = initWrapper(protocols);
......@@ -827,17 +841,17 @@ const getProvider = initGetProvider({
});
var shims = /*#__PURE__*/Object.freeze({
__proto__: null,
getProvider: getProvider
__proto__: null,
getProvider: getProvider
});
var protocols = /*#__PURE__*/Object.freeze({
__proto__: null,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
__proto__: null,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
});
var index = initUni(shims, protocols);
......
import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared';
import { onUnmounted } from 'vue';
import { onUnmounted, injectHook } from 'vue';
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -501,7 +501,7 @@ function initScopedSlotsParams(instance) {
const vueIds = instance.attrs.vueId;
if (vueIds) {
const vueId = vueIds.split(',')[0];
const object = center[vueId] = center[vueId] || {};
const object = (center[vueId] = center[vueId] || {});
object[name] = value;
if (parents[vueId]) {
parents[vueId].$forceUpdate();
......@@ -567,6 +567,13 @@ function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
findHooks(vueOptions).forEach((hook) => initHook$1(mpOptions, hook, excludes));
}
ks.appLaunchHooks = [];
function injectAppLaunchHooks(appInstance) {
ks.appLaunchHooks.forEach((hook) => {
injectHook(ON_LAUNCH, hook, appInstance);
});
}
const HOOKS = [
ON_SHOW,
ON_HIDE,
......@@ -591,7 +598,9 @@ function parseApp(instance, parseAppOptions) {
mpInstance: this,
slots: [],
});
injectAppLaunchHooks(internalInstance);
ctx.globalData = this.globalData;
options.app = this;
instance.$callHook(ON_LAUNCH, options);
},
};
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isPromise, isFunction, extend } from '@vue/shared';
import { injectHook } from 'vue';
//App
const ON_LAUNCH = 'onLaunch';
const eventChannels = {};
const eventChannelStack = [];
......@@ -36,6 +40,15 @@ const navigateTo = {
},
};
qq.appLaunchHooks = [];
function onAppLaunch(hook) {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return injectHook(ON_LAUNCH, hook, app.$vm.$);
}
qq.appLaunchHooks.push(hook);
}
function getBaseSystemInfo() {
return qq.getSystemInfoSync()
}
......@@ -722,6 +735,7 @@ const baseApis = {
upx2px,
addInterceptor,
removeInterceptor,
onAppLaunch,
};
function initUni(api, protocols) {
const wrapper = initWrapper(protocols);
......@@ -827,17 +841,17 @@ const getProvider = initGetProvider({
});
var shims = /*#__PURE__*/Object.freeze({
__proto__: null,
getProvider: getProvider
__proto__: null,
getProvider: getProvider
});
var protocols = /*#__PURE__*/Object.freeze({
__proto__: null,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
__proto__: null,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
});
var index = initUni(shims, protocols);
......
import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared';
import { onUnmounted } from 'vue';
import { onUnmounted, injectHook } from 'vue';
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -501,7 +501,7 @@ function initScopedSlotsParams(instance) {
const vueIds = instance.attrs.vueId;
if (vueIds) {
const vueId = vueIds.split(',')[0];
const object = center[vueId] = center[vueId] || {};
const object = (center[vueId] = center[vueId] || {});
object[name] = value;
if (parents[vueId]) {
parents[vueId].$forceUpdate();
......@@ -567,6 +567,13 @@ function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
findHooks(vueOptions).forEach((hook) => initHook$1(mpOptions, hook, excludes));
}
qq.appLaunchHooks = [];
function injectAppLaunchHooks(appInstance) {
qq.appLaunchHooks.forEach((hook) => {
injectHook(ON_LAUNCH, hook, appInstance);
});
}
const HOOKS = [
ON_SHOW,
ON_HIDE,
......@@ -591,7 +598,9 @@ function parseApp(instance, parseAppOptions) {
mpInstance: this,
slots: [],
});
injectAppLaunchHooks(internalInstance);
ctx.globalData = this.globalData;
options.app = this;
instance.$callHook(ON_LAUNCH, options);
},
};
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isPromise, isFunction, extend } from '@vue/shared';
import { injectHook } from 'vue';
//App
const ON_LAUNCH = 'onLaunch';
const eventChannels = {};
const eventChannelStack = [];
......@@ -36,6 +40,15 @@ const navigateTo = {
},
};
tt.appLaunchHooks = [];
function onAppLaunch(hook) {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return injectHook(ON_LAUNCH, hook, app.$vm.$);
}
tt.appLaunchHooks.push(hook);
}
function getBaseSystemInfo() {
return tt.getSystemInfoSync()
}
......@@ -722,6 +735,7 @@ const baseApis = {
upx2px,
addInterceptor,
removeInterceptor,
onAppLaunch,
};
function initUni(api, protocols) {
const wrapper = initWrapper(protocols);
......@@ -809,8 +823,8 @@ const getProvider = initGetProvider({
});
var shims = /*#__PURE__*/Object.freeze({
__proto__: null,
getProvider: getProvider
__proto__: null,
getProvider: getProvider
});
const chooseImage = {
......@@ -886,23 +900,23 @@ const getFileInfo = {
};
var protocols = /*#__PURE__*/Object.freeze({
__proto__: null,
chooseImage: chooseImage,
connectSocket: connectSocket,
chooseVideo: chooseVideo,
scanCode: scanCode,
startAccelerometer: startAccelerometer,
showToast: showToast,
showLoading: showLoading,
showModal: showModal,
showActionSheet: showActionSheet,
login: login,
getUserInfo: getUserInfo,
requestPayment: requestPayment,
getFileInfo: getFileInfo,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage
__proto__: null,
chooseImage: chooseImage,
connectSocket: connectSocket,
chooseVideo: chooseVideo,
scanCode: scanCode,
startAccelerometer: startAccelerometer,
showToast: showToast,
showLoading: showLoading,
showModal: showModal,
showActionSheet: showActionSheet,
login: login,
getUserInfo: getUserInfo,
requestPayment: requestPayment,
getFileInfo: getFileInfo,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage
});
var index = initUni(shims, protocols);
......
import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared';
import { onUnmounted } from 'vue';
import { onUnmounted, injectHook } from 'vue';
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -501,7 +501,7 @@ function initScopedSlotsParams(instance) {
const vueIds = instance.attrs.vueId;
if (vueIds) {
const vueId = vueIds.split(',')[0];
const object = center[vueId] = center[vueId] || {};
const object = (center[vueId] = center[vueId] || {});
object[name] = value;
if (parents[vueId]) {
parents[vueId].$forceUpdate();
......@@ -570,6 +570,13 @@ function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
findHooks(vueOptions).forEach((hook) => initHook$1(mpOptions, hook, excludes));
}
tt.appLaunchHooks = [];
function injectAppLaunchHooks(appInstance) {
tt.appLaunchHooks.forEach((hook) => {
injectHook(ON_LAUNCH, hook, appInstance);
});
}
const HOOKS = [
ON_SHOW,
ON_HIDE,
......@@ -594,7 +601,9 @@ function parseApp(instance, parseAppOptions) {
mpInstance: this,
slots: [],
});
injectAppLaunchHooks(internalInstance);
ctx.globalData = this.globalData;
options.app = this;
instance.$callHook(ON_LAUNCH, options);
},
};
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isPromise, isFunction, extend } from '@vue/shared';
import { injectHook } from 'vue';
//App
const ON_LAUNCH = 'onLaunch';
wx.appLaunchHooks = [];
function onAppLaunch(hook) {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return injectHook(ON_LAUNCH, hook, app.$vm.$);
}
wx.appLaunchHooks.push(hook);
}
function getBaseSystemInfo() {
return wx.getSystemInfoSync()
......@@ -686,6 +699,7 @@ const baseApis = {
upx2px,
addInterceptor,
removeInterceptor,
onAppLaunch,
};
function initUni(api, protocols) {
const wrapper = initWrapper(protocols);
......@@ -791,16 +805,16 @@ const getProvider = initGetProvider({
});
var shims = /*#__PURE__*/Object.freeze({
__proto__: null,
getProvider: getProvider
__proto__: null,
getProvider: getProvider
});
var protocols = /*#__PURE__*/Object.freeze({
__proto__: null,
redirectTo: redirectTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
__proto__: null,
redirectTo: redirectTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
});
var index = initUni(shims, protocols);
......
import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared';
import { onUnmounted } from 'vue';
import { onUnmounted, injectHook } from 'vue';
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -447,7 +447,7 @@ function initScopedSlotsParams(instance) {
const vueIds = instance.attrs.vueId;
if (vueIds) {
const vueId = vueIds.split(',')[0];
const object = center[vueId] = center[vueId] || {};
const object = (center[vueId] = center[vueId] || {});
object[name] = value;
if (parents[vueId]) {
parents[vueId].$forceUpdate();
......@@ -513,6 +513,13 @@ function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
findHooks(vueOptions).forEach((hook) => initHook$1(mpOptions, hook, excludes));
}
wx.appLaunchHooks = [];
function injectAppLaunchHooks(appInstance) {
wx.appLaunchHooks.forEach((hook) => {
injectHook(ON_LAUNCH, hook, appInstance);
});
}
const HOOKS = [
ON_SHOW,
ON_HIDE,
......@@ -537,7 +544,9 @@ function parseApp(instance, parseAppOptions) {
mpInstance: this,
slots: [],
});
injectAppLaunchHooks(internalInstance);
ctx.globalData = this.globalData;
options.app = this;
instance.$callHook(ON_LAUNCH, options);
},
};
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isPromise, isFunction, extend } from '@vue/shared';
import { injectHook } from 'vue';
//App
const ON_LAUNCH = 'onLaunch';
const eventChannels = {};
const eventChannelStack = [];
......@@ -36,6 +40,15 @@ const navigateTo = {
},
};
qa.appLaunchHooks = [];
function onAppLaunch(hook) {
const app = getApp({ allowDefault: true });
if (app && app.$vm) {
return injectHook(ON_LAUNCH, hook, app.$vm.$);
}
qa.appLaunchHooks.push(hook);
}
function getBaseSystemInfo() {
return qa.getSystemInfoSync()
}
......@@ -722,6 +735,7 @@ const baseApis = {
upx2px,
addInterceptor,
removeInterceptor,
onAppLaunch,
};
function initUni(api, protocols) {
const wrapper = initWrapper(protocols);
......@@ -834,17 +848,17 @@ if (qa.canIUse('getVendorPaymentProvider')) {
const getProvider = initGetProvider(providers);
var shims = /*#__PURE__*/Object.freeze({
__proto__: null,
getProvider: getProvider
__proto__: null,
getProvider: getProvider
});
var protocols = /*#__PURE__*/Object.freeze({
__proto__: null,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
__proto__: null,
redirectTo: redirectTo,
navigateTo: navigateTo,
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync
});
var index = initUni(shims, protocols);
......
import { isPlainObject, hasOwn, isArray, extend, hyphenate, isObject, toNumber, isFunction, NOOP, camelize } from '@vue/shared';
import { injectHook } from 'vue';
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -497,6 +498,13 @@ function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
findHooks(vueOptions).forEach((hook) => initHook$1(mpOptions, hook, excludes));
}
qa.appLaunchHooks = [];
function injectAppLaunchHooks(appInstance) {
qa.appLaunchHooks.forEach((hook) => {
injectHook(ON_LAUNCH, hook, appInstance);
});
}
const HOOKS = [
ON_SHOW,
ON_HIDE,
......@@ -521,7 +529,9 @@ function parseApp(instance, parseAppOptions) {
mpInstance: this,
slots: [],
});
injectAppLaunchHooks(internalInstance);
ctx.globalData = this.globalData;
options.app = this;
instance.$callHook(ON_LAUNCH, options);
},
};
......
......@@ -307,7 +307,9 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
.UNI_INPUT_DIR), // css中的'@/static/logo.png'会被转换成'./@/static/logo.png'加载
vue$: getPlatformVue(vueOptions),
'uni-pages': path.resolve(process.env.UNI_INPUT_DIR, 'pages.json'),
'@dcloudio/uni-stat': require.resolve('@dcloudio/uni-stat'),
'@dcloudio/uni-stat': process.env.UNI_USING_VUE3 ? require.resolve(
'@dcloudio/vue-cli-plugin-uni/packages/uni-stat') : require
.resolve('@dcloudio/uni-stat'),
'uni-stat-config': path.resolve(process.env.UNI_INPUT_DIR, 'pages.json') +
'?' +
JSON.stringify({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册