提交 0d3256d8 编写于 作者: fxy060608's avatar fxy060608

build mp runtime #411

上级 88418d31
......@@ -433,13 +433,35 @@ function initMocks (vm, mocks) {
});
}
function initHooks (mpOptions, hooks) {
function hasHook (hook, vueOptions) {
if (!vueOptions) {
return true
}
vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions;
}
if (isFn(vueOptions[hook])) {
return true
}
const mixins = vueOptions.mixins;
if (Array.isArray(mixins)) {
return !!mixins.find(mixin => hasHook(hook, mixin))
}
}
function initHooks (mpOptions, hooks, vueOptions) {
hooks.forEach(hook => {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
if (hasHook(hook, vueOptions)) {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
}
});
}
}
function initVueComponent (Vue$$1, vueOptions) {
vueOptions = vueOptions.default || vueOptions;
......@@ -1115,7 +1137,7 @@ function parseBasePage (vuePageOptions, {
initRelation
});
initHooks(pageOptions.methods, hooks$2);
initHooks(pageOptions.methods, hooks$2, vuePageOptions);
pageOptions.methods.onLoad = function (args) {
this.$vm.$mp.query = args; // 兼容 mpvue
......
{
"name": "@dcloudio/uni-app-plus",
"version": "0.0.241",
"version": "0.0.242",
"description": "uni-app app-plus",
"main": "dist/index.js",
"scripts": {
......
......@@ -752,13 +752,35 @@ function initMocks (vm, mocks) {
});
}
function initHooks (mpOptions, hooks) {
function hasHook (hook, vueOptions) {
if (!vueOptions) {
return true
}
vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions;
}
if (isFn(vueOptions[hook])) {
return true
}
const mixins = vueOptions.mixins;
if (Array.isArray(mixins)) {
return !!mixins.find(mixin => hasHook(hook, mixin))
}
}
function initHooks (mpOptions, hooks, vueOptions) {
hooks.forEach(hook => {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
if (hasHook(hook, vueOptions)) {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
}
});
}
}
function initVueComponent (Vue$$1, vueOptions) {
vueOptions = vueOptions.default || vueOptions;
......
{
"name": "@dcloudio/uni-mp-alipay",
"version": "0.0.814",
"version": "0.0.815",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"scripts": {
......
......@@ -533,13 +533,35 @@ function initMocks (vm, mocks) {
});
}
function initHooks (mpOptions, hooks) {
function hasHook (hook, vueOptions) {
if (!vueOptions) {
return true
}
vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions;
}
if (isFn(vueOptions[hook])) {
return true
}
const mixins = vueOptions.mixins;
if (Array.isArray(mixins)) {
return !!mixins.find(mixin => hasHook(hook, mixin))
}
}
function initHooks (mpOptions, hooks, vueOptions) {
hooks.forEach(hook => {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
if (hasHook(hook, vueOptions)) {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
}
});
}
}
function initVueComponent (Vue$$1, vueOptions) {
vueOptions = vueOptions.default || vueOptions;
......@@ -1245,7 +1267,7 @@ function parseBasePage (vuePageOptions, {
initRelation
});
initHooks(pageOptions.methods, hooks$1);
initHooks(pageOptions.methods, hooks$1, vuePageOptions);
pageOptions.methods.onLoad = function (args) {
this.$vm.$mp.query = args; // 兼容 mpvue
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.841",
"version": "0.0.842",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
......@@ -578,13 +578,35 @@ function initMocks (vm, mocks) {
});
}
function initHooks (mpOptions, hooks) {
function hasHook (hook, vueOptions) {
if (!vueOptions) {
return true
}
vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions;
}
if (isFn(vueOptions[hook])) {
return true
}
const mixins = vueOptions.mixins;
if (Array.isArray(mixins)) {
return !!mixins.find(mixin => hasHook(hook, mixin))
}
}
function initHooks (mpOptions, hooks, vueOptions) {
hooks.forEach(hook => {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
if (hasHook(hook, vueOptions)) {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
}
});
}
}
function initVueComponent (Vue$$1, vueOptions) {
vueOptions = vueOptions.default || vueOptions;
......@@ -1327,7 +1349,7 @@ function parseBasePage (vuePageOptions, {
initRelation
});
initHooks(pageOptions.methods, hooks$1);
initHooks(pageOptions.methods, hooks$1, vuePageOptions);
pageOptions.methods.onLoad = function (args) {
this.$vm.$mp.query = args; // 兼容 mpvue
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.338",
"version": "0.0.339",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
......
......@@ -435,13 +435,35 @@ function initMocks (vm, mocks) {
});
}
function initHooks (mpOptions, hooks) {
function hasHook (hook, vueOptions) {
if (!vueOptions) {
return true
}
vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions;
}
if (isFn(vueOptions[hook])) {
return true
}
const mixins = vueOptions.mixins;
if (Array.isArray(mixins)) {
return !!mixins.find(mixin => hasHook(hook, mixin))
}
}
function initHooks (mpOptions, hooks, vueOptions) {
hooks.forEach(hook => {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
if (hasHook(hook, vueOptions)) {
mpOptions[hook] = function (args) {
return this.$vm && this.$vm.__call_hook(hook, args)
};
}
});
}
}
function initVueComponent (Vue$$1, vueOptions) {
vueOptions = vueOptions.default || vueOptions;
......@@ -1101,7 +1123,7 @@ function parseBasePage (vuePageOptions, {
initRelation
});
initHooks(pageOptions.methods, hooks$1);
initHooks(pageOptions.methods, hooks$1, vuePageOptions);
pageOptions.methods.onLoad = function (args) {
this.$vm.$mp.query = args; // 兼容 mpvue
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.960",
"version": "0.0.961",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册