From 1573f1a18cb41baf530fec2ac29f97e7e5d606ce Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 2 Sep 2019 17:53:02 +0800 Subject: [PATCH] fix(mp): vuex store --- packages/uni-app-plus/dist/index.js | 10 +++++----- packages/uni-mp-alipay/dist/index.js | 10 +++++----- packages/uni-mp-baidu/dist/index.js | 10 +++++----- packages/uni-mp-qq/dist/index.js | 10 +++++----- packages/uni-mp-toutiao/dist/index.js | 10 +++++----- packages/uni-mp-weixin/dist/index.js | 10 +++++----- packages/vue-cli-plugin-uni/generator.js | 5 +++-- .../mp-weixin/runtime/wrapper/app-base-parser.js | 10 +++++----- 8 files changed, 38 insertions(+), 37 deletions(-) diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 5d14111e9..231429991 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1112,7 +1112,11 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + Vue.prototype.mpHost = "app-plus"; Vue.mixin({ @@ -1136,10 +1140,6 @@ function parseBaseApp (vm, { if (this.mpType !== 'app') { initRefs(this); initMocks(this, mocks); - } else { - if (this.$options.store) { // vuex store - Vue.prototype.$store = this.$options.store; - } } } }); diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index 741537389..b9671ba6b 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -1513,7 +1513,11 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + Vue.prototype.mpHost = "mp-alipay"; Vue.mixin({ @@ -1537,10 +1541,6 @@ function parseBaseApp (vm, { if (this.mpType !== 'app') { initRefs(this); initMocks(this, mocks); - } else { - if (this.$options.store) { // vuex store - Vue.prototype.$store = this.$options.store; - } } } }); diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index ad818b630..c62d5d875 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -1258,7 +1258,11 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + Vue.prototype.mpHost = "mp-baidu"; Vue.mixin({ @@ -1282,10 +1286,6 @@ function parseBaseApp (vm, { if (this.mpType !== 'app') { initRefs(this); initMocks(this, mocks); - } else { - if (this.$options.store) { // vuex store - Vue.prototype.$store = this.$options.store; - } } } }); diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 34ae0d814..1e4bc0ec2 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1176,7 +1176,11 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + Vue.prototype.mpHost = "mp-qq"; Vue.mixin({ @@ -1200,10 +1204,6 @@ function parseBaseApp (vm, { if (this.mpType !== 'app') { initRefs(this); initMocks(this, mocks); - } else { - if (this.$options.store) { // vuex store - Vue.prototype.$store = this.$options.store; - } } } }); diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index c3e299538..e421bd566 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1268,7 +1268,11 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + Vue.prototype.mpHost = "mp-toutiao"; Vue.mixin({ @@ -1292,10 +1296,6 @@ function parseBaseApp (vm, { if (this.mpType !== 'app') { initRefs(this); initMocks(this, mocks); - } else { - if (this.$options.store) { // vuex store - Vue.prototype.$store = this.$options.store; - } } } }); diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index 8225c9260..de5a7f5e3 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1116,7 +1116,11 @@ const hooks = [ function parseBaseApp (vm, { mocks, initRefs -}) { +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store; + } + Vue.prototype.mpHost = "mp-weixin"; Vue.mixin({ @@ -1140,10 +1144,6 @@ function parseBaseApp (vm, { if (this.mpType !== 'app') { initRefs(this); initMocks(this, mocks); - } else { - if (this.$options.store) { // vuex store - Vue.prototype.$store = this.$options.store; - } } } }); diff --git a/packages/vue-cli-plugin-uni/generator.js b/packages/vue-cli-plugin-uni/generator.js index baf3dbb3a..3baa585c8 100644 --- a/packages/vue-cli-plugin-uni/generator.js +++ b/packages/vue-cli-plugin-uni/generator.js @@ -1,7 +1,8 @@ module.exports = (api, options, rootOptions) => { let version = '*' - if (require('./package.json').version.indexOf('alpha') !== -1) { - version = '^2.0.0-alpha-22420190823001' + const mainVersion = require('./package.json').version + if (mainVersion.indexOf('alpha') !== -1) { + version = '^' + mainVersion } api.extendPackage(pkg => { delete pkg.postcss diff --git a/src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js b/src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js index 8a0b759cd..00cb1cc68 100644 --- a/src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js +++ b/src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js @@ -15,7 +15,11 @@ const hooks = [ export default function parseBaseApp (vm, { mocks, initRefs -}) { +}) { + if (vm.$options.store) { + Vue.prototype.$store = vm.$options.store + } + Vue.prototype.mpHost = __PLATFORM__ Vue.mixin({ @@ -39,10 +43,6 @@ export default function parseBaseApp (vm, { if (this.mpType !== 'app') { initRefs(this) initMocks(this, mocks) - } else { - if (this.$options.store) { // vuex store - Vue.prototype.$store = this.$options.store - } } } }) -- GitLab