提交 07fb41e6 编写于 作者: fxy060608's avatar fxy060608

chore: merge

......@@ -13212,7 +13212,9 @@
var args = Array.prototype.slice.call(arguments);
args[1] *= pixelRatio;
args[2] *= pixelRatio;
args[3] *= pixelRatio;
if (args[3] && typeof args[3] === "number") {
args[3] *= pixelRatio;
}
var font2 = this.font;
this.font = font2.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function(w, m, u) {
return m * pixelRatio + u;
......@@ -13229,7 +13231,9 @@
var args = Array.prototype.slice.call(arguments);
args[1] *= pixelRatio;
args[2] *= pixelRatio;
args[3] *= pixelRatio;
if (args[3] && typeof args[3] === "number") {
args[3] *= pixelRatio;
}
var font2 = this.font;
this.font = font2.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function(w, m, u) {
return m * pixelRatio + u;
......
......@@ -129,7 +129,12 @@ export function initHidpi() {
args[1] *= pixelRatio
args[2] *= pixelRatio
args[3] *= pixelRatio
// 因为 canvasCtx.fillText 的第 4 个参数为可选参数,用户可能不传,
// 所以在处理时需要判断一下,否则 undefined * pixelRatio => NaN,
// 会导致 canvas 无法绘制。
if (args[3] && typeof args[3] === 'number') {
args[3] *= pixelRatio
}
var font = this.font
this.font = font.replace(
......@@ -154,7 +159,12 @@ export function initHidpi() {
args[1] *= pixelRatio // x
args[2] *= pixelRatio // y
args[3] *= pixelRatio
// 因为 canvasCtx.strokeText 的第 4 个参数为可选参数,用户可能不传,
// 所以在处理时需要判断一下,否则 undefined * pixelRatio => NaN,
// 会导致 canvas 无法绘制。
if (args[3] && typeof args[3] === 'number') {
args[3] *= pixelRatio
}
var font = this.font
this.font = font.replace(
......
......@@ -6402,7 +6402,9 @@ function initHidpi() {
const args = Array.prototype.slice.call(arguments);
args[1] *= pixelRatio;
args[2] *= pixelRatio;
args[3] *= pixelRatio;
if (args[3] && typeof args[3] === "number") {
args[3] *= pixelRatio;
}
var font2 = this.font;
this.font = font2.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function(w, m, u) {
return m * pixelRatio + u;
......@@ -6419,7 +6421,9 @@ function initHidpi() {
var args = Array.prototype.slice.call(arguments);
args[1] *= pixelRatio;
args[2] *= pixelRatio;
args[3] *= pixelRatio;
if (args[3] && typeof args[3] === "number") {
args[3] *= pixelRatio;
}
var font2 = this.font;
this.font = font2.replace(/(\d+\.?\d*)(px|em|rem|pt)/g, function(w, m, u) {
return m * pixelRatio + u;
......
......@@ -130,7 +130,17 @@ const invokeArrayFns = (fns, arg) => {
ret = fns[i](arg);
}
return ret;
};
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -388,6 +398,27 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
initHook$1(mpOptions, hook, []);
}
});
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks = [];
const app = getApp({ allowDefault: true });
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins;
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
});
}
}
return runtimeHooks;
});
function initMixinRuntimeHooks(mpOptions) {
initHooks(mpOptions, findMixinRuntimeHooks());
}
const HOOKS = [
......@@ -905,6 +936,7 @@ function parsePage(vueOptions, parseOptions) {
initHooks(methods, PAGE_INIT_HOOKS);
initUnknownHooks(methods, vueOptions);
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink });
return miniProgramPageOptions;
}
......
import {
MINI_PROGRAM_PAGE_RUNTIME_HOOKS,
once,
ON_ADD_TO_FAVORITES,
ON_HIDE,
ON_LOAD,
......@@ -11,7 +12,7 @@ import {
ON_TAB_ITEM_TAP,
ON_UNLOAD,
} from '@dcloudio/uni-shared'
import { hasOwn, isFunction } from '@vue/shared'
import { hasOwn, isArray, isFunction } from '@vue/shared'
import { ComponentOptions } from 'vue'
......@@ -113,3 +114,28 @@ export function initRuntimeHooks(
}
})
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks: string[] = []
const app = getApp({ allowDefault: true })
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins as ComponentOptions[]
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS)
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook)
}
})
})
}
}
return runtimeHooks
})
export function initMixinRuntimeHooks(
mpOptions: MiniProgramAppOptions | WechatMiniprogram.Component.MethodOption
) {
initHooks(mpOptions, findMixinRuntimeHooks())
}
......@@ -12,6 +12,7 @@ import {
initHooks,
initUnknownHooks,
initRuntimeHooks,
initMixinRuntimeHooks,
} from './componentHooks'
import { initPageProps } from './componentProps'
......@@ -51,6 +52,7 @@ function parsePage(
initHooks(methods, PAGE_INIT_HOOKS)
initUnknownHooks(methods, vueOptions)
initRuntimeHooks(methods, vueOptions.__runtimeHooks)
initMixinRuntimeHooks(methods)
parse && parse(miniProgramPageOptions, { handleLink })
return miniProgramPageOptions
......
......@@ -105,7 +105,17 @@ const invokeArrayFns = (fns, arg) => {
ret = fns[i](arg);
}
return ret;
};
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -363,6 +373,27 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
initHook$1(mpOptions, hook, []);
}
});
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks = [];
const app = getApp({ allowDefault: true });
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins;
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
});
}
}
return runtimeHooks;
});
function initMixinRuntimeHooks(mpOptions) {
initHooks(mpOptions, findMixinRuntimeHooks());
}
const HOOKS = [
......@@ -869,6 +900,7 @@ function parsePage(vueOptions, parseOptions) {
initHooks(methods, PAGE_INIT_HOOKS);
initUnknownHooks(methods, vueOptions);
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink });
return miniProgramPageOptions;
}
......
......@@ -105,7 +105,17 @@ const invokeArrayFns = (fns, arg) => {
ret = fns[i](arg);
}
return ret;
};
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -362,6 +372,27 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
initHook$1(mpOptions, hook, []);
}
});
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks = [];
const app = getApp({ allowDefault: true });
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins;
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
});
}
}
return runtimeHooks;
});
function initMixinRuntimeHooks(mpOptions) {
initHooks(mpOptions, findMixinRuntimeHooks());
}
const HOOKS = [
......@@ -842,6 +873,7 @@ function parsePage(vueOptions, parseOptions) {
initHooks(methods, PAGE_INIT_HOOKS);
initUnknownHooks(methods, vueOptions);
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink });
return miniProgramPageOptions;
}
......
......@@ -105,7 +105,17 @@ const invokeArrayFns = (fns, arg) => {
ret = fns[i](arg);
}
return ret;
};
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -359,6 +369,27 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
initHook$1(mpOptions, hook, []);
}
});
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks = [];
const app = getApp({ allowDefault: true });
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins;
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
});
}
}
return runtimeHooks;
});
function initMixinRuntimeHooks(mpOptions) {
initHooks(mpOptions, findMixinRuntimeHooks());
}
const HOOKS = [
......@@ -831,6 +862,7 @@ function parsePage(vueOptions, parseOptions) {
initHooks(methods, PAGE_INIT_HOOKS);
initUnknownHooks(methods, vueOptions);
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink });
return miniProgramPageOptions;
}
......
......@@ -105,7 +105,17 @@ const invokeArrayFns = (fns, arg) => {
ret = fns[i](arg);
}
return ret;
};
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -362,6 +372,27 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
initHook$1(mpOptions, hook, []);
}
});
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks = [];
const app = getApp({ allowDefault: true });
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins;
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
});
}
}
return runtimeHooks;
});
function initMixinRuntimeHooks(mpOptions) {
initHooks(mpOptions, findMixinRuntimeHooks());
}
const HOOKS = [
......@@ -842,6 +873,7 @@ function parsePage(vueOptions, parseOptions) {
initHooks(methods, PAGE_INIT_HOOKS);
initUnknownHooks(methods, vueOptions);
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink });
return miniProgramPageOptions;
}
......
......@@ -40,7 +40,17 @@ const invokeArrayFns = (fns, arg) => {
ret = fns[i](arg);
}
return ret;
};
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -231,6 +241,27 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
initHook$1(mpOptions, hook, []);
}
});
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks = [];
const app = getApp({ allowDefault: true });
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins;
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
});
}
}
return runtimeHooks;
});
function initMixinRuntimeHooks(mpOptions) {
initHooks(mpOptions, findMixinRuntimeHooks());
}
const HOOKS = [
......@@ -703,6 +734,7 @@ function parsePage(vueOptions, parseOptions) {
initHooks(methods, PAGE_INIT_HOOKS);
initUnknownHooks(methods, vueOptions);
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink });
return miniProgramPageOptions;
}
......
......@@ -105,7 +105,17 @@ const invokeArrayFns = (fns, arg) => {
ret = fns[i](arg);
}
return ret;
};
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
......@@ -359,6 +369,27 @@ function initRuntimeHooks(mpOptions, runtimeHooks) {
initHook$1(mpOptions, hook, []);
}
});
}
const findMixinRuntimeHooks = /*#__PURE__*/ once(() => {
const runtimeHooks = [];
const app = getApp({ allowDefault: true });
if (app && app.$vm && app.$vm.$) {
const mixins = app.$vm.$.appContext.mixins;
if (isArray(mixins)) {
const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
mixins.forEach((mixin) => {
hooks.forEach((hook) => {
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
runtimeHooks.push(hook);
}
});
});
}
}
return runtimeHooks;
});
function initMixinRuntimeHooks(mpOptions) {
initHooks(mpOptions, findMixinRuntimeHooks());
}
const HOOKS = [
......@@ -820,6 +851,7 @@ function parsePage(vueOptions, parseOptions) {
initHooks(methods, PAGE_INIT_HOOKS);
initUnknownHooks(methods, vueOptions);
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
initMixinRuntimeHooks(methods);
parse && parse(miniProgramPageOptions, { handleLink });
return miniProgramPageOptions;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册