提交 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);
......
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);
......
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);
......
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);
......
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);
......
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);
......
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);
......
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.
先完成此消息的编辑!
想要评论请 注册