diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 5d14111e99aa7f0c86086cecc716706eef7b010a..231429991b28940b938c4ec79673aea2a2bd73f4 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 741537389fea209b91b5ef64ea0b2ab4e570431b..b9671ba6b936fc01a522d9badecb9ab918955a64 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 ad818b63098eac710dbe3ea6589908f1e4ac1b82..c62d5d875103744b33644cf2d2c1b0cab1c61438 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 34ae0d814c7d65e72ae59614ef23c273a7e24d99..1e4bc0ec2a32c62230a71abbeab2a99a9e909916 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 c3e2995381ca575248cd2bfa8d017f7a80072f03..e421bd56694cf715c9f0c66e1c4fcfbca5777b70 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 8225c9260afe829c7f05bcb2a234d5910cd6fb97..de5a7f5e39292011201ce491bb00c23caebda0e4 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 baf3dbb3a9fb5586c036cda6d361312b7bb6de79..3baa585c89a1c2249396e25f63779f41cc52882c 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 8a0b759cdd62e3a68869e69b5a3dd3a7397ef6e3..00cb1cc6840443e92a16ea2bad7418a13f15af36 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 - } } } })