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

fix(mp): improve hasHook #300

上级 9b63b254
...@@ -441,7 +441,15 @@ function hasHook (hook, vueOptions) { ...@@ -441,7 +441,15 @@ function hasHook (hook, vueOptions) {
vueOptions = vueOptions.default || vueOptions; vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) { if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions; if (isFn(vueOptions.extendOptions[hook])) {
return true
}
if (vueOptions.super &&
vueOptions.super.options &&
Array.isArray(vueOptions.super.options[hook])) {
return true
}
return false
} }
if (isFn(vueOptions[hook])) { if (isFn(vueOptions[hook])) {
...@@ -907,6 +915,9 @@ function parseBaseApp (vm, { ...@@ -907,6 +915,9 @@ function parseBaseApp (vm, {
const appOptions = { const appOptions = {
onLaunch (args) { onLaunch (args) {
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
}
this.$vm = vm; this.$vm = vm;
......
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "0.0.242", "version": "0.0.243",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -760,7 +760,15 @@ function hasHook (hook, vueOptions) { ...@@ -760,7 +760,15 @@ function hasHook (hook, vueOptions) {
vueOptions = vueOptions.default || vueOptions; vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) { if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions; if (isFn(vueOptions.extendOptions[hook])) {
return true
}
if (vueOptions.super &&
vueOptions.super.options &&
Array.isArray(vueOptions.super.options[hook])) {
return true
}
return false
} }
if (isFn(vueOptions[hook])) { if (isFn(vueOptions[hook])) {
...@@ -1216,6 +1224,9 @@ function parseBaseApp (vm, { ...@@ -1216,6 +1224,9 @@ function parseBaseApp (vm, {
const appOptions = { const appOptions = {
onLaunch (args) { onLaunch (args) {
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
}
this.$vm = vm; this.$vm = vm;
......
{ {
"name": "@dcloudio/uni-mp-alipay", "name": "@dcloudio/uni-mp-alipay",
"version": "0.0.816", "version": "0.0.817",
"description": "uni-app mp-alipay", "description": "uni-app mp-alipay",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -541,7 +541,15 @@ function hasHook (hook, vueOptions) { ...@@ -541,7 +541,15 @@ function hasHook (hook, vueOptions) {
vueOptions = vueOptions.default || vueOptions; vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) { if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions; if (isFn(vueOptions.extendOptions[hook])) {
return true
}
if (vueOptions.super &&
vueOptions.super.options &&
Array.isArray(vueOptions.super.options[hook])) {
return true
}
return false
} }
if (isFn(vueOptions[hook])) { if (isFn(vueOptions[hook])) {
......
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "0.0.843", "version": "0.0.844",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -505,7 +505,15 @@ function hasHook (hook, vueOptions) { ...@@ -505,7 +505,15 @@ function hasHook (hook, vueOptions) {
vueOptions = vueOptions.default || vueOptions; vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) { if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions; if (isFn(vueOptions.extendOptions[hook])) {
return true
}
if (vueOptions.super &&
vueOptions.super.options &&
Array.isArray(vueOptions.super.options[hook])) {
return true
}
return false
} }
if (isFn(vueOptions[hook])) { if (isFn(vueOptions[hook])) {
...@@ -971,6 +979,9 @@ function parseBaseApp (vm, { ...@@ -971,6 +979,9 @@ function parseBaseApp (vm, {
const appOptions = { const appOptions = {
onLaunch (args) { onLaunch (args) {
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
}
this.$vm = vm; this.$vm = vm;
......
{ {
"name": "@dcloudio/uni-mp-qq", "name": "@dcloudio/uni-mp-qq",
"version": "0.0.100", "version": "0.0.101",
"description": "uni-app mp-qq", "description": "uni-app mp-qq",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -586,7 +586,15 @@ function hasHook (hook, vueOptions) { ...@@ -586,7 +586,15 @@ function hasHook (hook, vueOptions) {
vueOptions = vueOptions.default || vueOptions; vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) { if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions; if (isFn(vueOptions.extendOptions[hook])) {
return true
}
if (vueOptions.super &&
vueOptions.super.options &&
Array.isArray(vueOptions.super.options[hook])) {
return true
}
return false
} }
if (isFn(vueOptions[hook])) { if (isFn(vueOptions[hook])) {
...@@ -1052,6 +1060,9 @@ function parseBaseApp (vm, { ...@@ -1052,6 +1060,9 @@ function parseBaseApp (vm, {
const appOptions = { const appOptions = {
onLaunch (args) { onLaunch (args) {
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
}
this.$vm = vm; this.$vm = vm;
......
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.340", "version": "0.0.341",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -443,7 +443,15 @@ function hasHook (hook, vueOptions) { ...@@ -443,7 +443,15 @@ function hasHook (hook, vueOptions) {
vueOptions = vueOptions.default || vueOptions; vueOptions = vueOptions.default || vueOptions;
if (isFn(vueOptions)) { if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions; if (isFn(vueOptions.extendOptions[hook])) {
return true
}
if (vueOptions.super &&
vueOptions.super.options &&
Array.isArray(vueOptions.super.options[hook])) {
return true
}
return false
} }
if (isFn(vueOptions[hook])) { if (isFn(vueOptions[hook])) {
...@@ -909,6 +917,9 @@ function parseBaseApp (vm, { ...@@ -909,6 +917,9 @@ function parseBaseApp (vm, {
const appOptions = { const appOptions = {
onLaunch (args) { onLaunch (args) {
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
return
}
{ {
if (!wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断 if (!wx.canIUse('nextTick')) { // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上'); console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.961", "version": "0.0.962",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -31,7 +31,15 @@ function hasHook (hook, vueOptions) { ...@@ -31,7 +31,15 @@ function hasHook (hook, vueOptions) {
vueOptions = vueOptions.default || vueOptions vueOptions = vueOptions.default || vueOptions
if (isFn(vueOptions)) { if (isFn(vueOptions)) {
vueOptions = vueOptions.extendOptions if (isFn(vueOptions.extendOptions[hook])) {
return true
}
if (vueOptions.super &&
vueOptions.super.options &&
Array.isArray(vueOptions.super.options[hook])) {
return true
}
return false
} }
if (isFn(vueOptions[hook])) { if (isFn(vueOptions[hook])) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册