diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 2edd4e894aea35c4a434d940e58386ab647e5870..c086103b1e904c6af89d8b03faf9ca0beda2c9b3 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1134,10 +1134,10 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } Vue.prototype.mpHost = "app-plus"; @@ -1178,8 +1178,8 @@ function parseBaseApp (vm, { app: this }; - this.$vm.$scope = this; - // vm 上也挂载 globalData + this.$vm.$scope = this; + // vm 上也挂载 globalData this.$vm.globalData = this.globalData; this.$vm._isMounted = true; @@ -1191,6 +1191,13 @@ function parseBaseApp (vm, { // 兼容旧版本 globalData appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } initHooks(appOptions, hooks); diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 4fca9f7392a0fbab254303787f5f3d3e7010bf93..56af4cf46e04a1229bcf50ec07ae42b1f17536a4 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -1526,10 +1526,10 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } Vue.prototype.mpHost = "mp-alipay"; @@ -1570,8 +1570,8 @@ function parseBaseApp (vm, { app: this }; - this.$vm.$scope = this; - // vm 上也挂载 globalData + this.$vm.$scope = this; + // vm 上也挂载 globalData this.$vm.globalData = this.globalData; this.$vm._isMounted = true; @@ -1583,6 +1583,13 @@ function parseBaseApp (vm, { // 兼容旧版本 globalData appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } initHooks(appOptions, hooks); diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index ed18e1bb7a3f039f80eaf1427bffa2e974724a03..bd339e8e3491a294fa6290ecd297af9cec4f45bd 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -1271,10 +1271,10 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } Vue.prototype.mpHost = "mp-baidu"; @@ -1315,8 +1315,8 @@ function parseBaseApp (vm, { app: this }; - this.$vm.$scope = this; - // vm 上也挂载 globalData + this.$vm.$scope = this; + // vm 上也挂载 globalData this.$vm.globalData = this.globalData; this.$vm._isMounted = true; @@ -1328,6 +1328,13 @@ function parseBaseApp (vm, { // 兼容旧版本 globalData appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } initHooks(appOptions, hooks); diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index edfd191af674af3c66cac068387b71d24aa896df..a6941563ab3b2e53d0b1f75f0d90d9d61b05ba69 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1189,10 +1189,10 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } Vue.prototype.mpHost = "mp-qq"; @@ -1238,8 +1238,8 @@ function parseBaseApp (vm, { app: this }; - this.$vm.$scope = this; - // vm 上也挂载 globalData + this.$vm.$scope = this; + // vm 上也挂载 globalData this.$vm.globalData = this.globalData; this.$vm._isMounted = true; @@ -1251,6 +1251,13 @@ function parseBaseApp (vm, { // 兼容旧版本 globalData appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } initHooks(appOptions, hooks); diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index 9f7142b8aa3db1a2210324f00769dab12d8b767e..ae936d93db0c061533b007267e3fbeb139e2c368 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1281,10 +1281,10 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } Vue.prototype.mpHost = "mp-toutiao"; @@ -1325,8 +1325,8 @@ function parseBaseApp (vm, { app: this }; - this.$vm.$scope = this; - // vm 上也挂载 globalData + this.$vm.$scope = this; + // vm 上也挂载 globalData this.$vm.globalData = this.globalData; this.$vm._isMounted = true; @@ -1338,6 +1338,13 @@ function parseBaseApp (vm, { // 兼容旧版本 globalData appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } initHooks(appOptions, hooks); diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index 107520ea4321ee4a52648011380acc1be0a43870..4cae2bb85e299ab1360704119131391395f0b546 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1129,10 +1129,10 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { - if (vm.$options.store) { - Vue.prototype.$store = vm.$options.store; - } +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } Vue.prototype.mpHost = "mp-weixin"; @@ -1178,8 +1178,8 @@ function parseBaseApp (vm, { app: this }; - this.$vm.$scope = this; - // vm 上也挂载 globalData + this.$vm.$scope = this; + // vm 上也挂载 globalData this.$vm.globalData = this.globalData; this.$vm._isMounted = true; @@ -1191,6 +1191,13 @@ function parseBaseApp (vm, { // 兼容旧版本 globalData appOptions.globalData = vm.$options.globalData || {}; + // 将 methods 中的方法挂在 getApp() 中 + const methods = vm.$options.methods; + if (methods) { + Object.keys(methods).forEach(name => { + appOptions[name] = methods[name]; + }); + } initHooks(appOptions, hooks);