From af95d5ef41b12ff8c6507807feb70172d478696d Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 17 Jan 2020 19:41:52 +0800 Subject: [PATCH] fix(v3): vuex --- packages/uni-app-plus/dist/index.v3.js | 8 +++++++- .../app-plus/service/framework/plugins/lifecycle.js | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index cc0b7fc5d..9cf8f9fd4 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -12986,7 +12986,8 @@ var serviceContext = (function () { onPageReachBottom, onReachBottomDistance, statusbarHeight, - windowTop: windowOptions.titleNView && windowOptions.titleNView.type === 'float' ? (statusbarHeight + TITLEBAR_HEIGHT) : 0, + windowTop: windowOptions.titleNView && windowOptions.titleNView.type === 'float' ? (statusbarHeight + + TITLEBAR_HEIGHT) : 0, windowBottom: (tabBar$1.indexOf(route) >= 0 && tabBar$1.cover) ? tabBar$1.height : 0 } } @@ -12999,6 +13000,11 @@ var serviceContext = (function () { // TODO 临时解决方案,service 层也注入 wxs (适用于工具类) const options = this.$options; + // 自动挂载 $store + if (options.store && !Vue.prototype.$store) { + Vue.prototype.$store = options.store; + } + const wxs = options.wxs; if (wxs) { Object.keys(wxs).forEach(module => { diff --git a/src/platforms/app-plus/service/framework/plugins/lifecycle.js b/src/platforms/app-plus/service/framework/plugins/lifecycle.js index e74a1ec56..604fa4276 100644 --- a/src/platforms/app-plus/service/framework/plugins/lifecycle.js +++ b/src/platforms/app-plus/service/framework/plugins/lifecycle.js @@ -47,7 +47,8 @@ function parsePageCreateOptions (vm, route) { onPageReachBottom, onReachBottomDistance, statusbarHeight, - windowTop: windowOptions.titleNView && windowOptions.titleNView.type === 'float' ? (statusbarHeight + TITLEBAR_HEIGHT) : 0, + windowTop: windowOptions.titleNView && windowOptions.titleNView.type === 'float' ? (statusbarHeight + + TITLEBAR_HEIGHT) : 0, windowBottom: (tabBar.indexOf(route) >= 0 && tabBar.cover) ? tabBar.height : 0 } } @@ -60,6 +61,11 @@ export function initLifecycle (Vue) { // TODO 临时解决方案,service 层也注入 wxs (适用于工具类) const options = this.$options + // 自动挂载 $store + if (options.store && !Vue.prototype.$store) { + Vue.prototype.$store = options.store + } + const wxs = options.wxs if (wxs) { Object.keys(wxs).forEach(module => { @@ -95,4 +101,4 @@ export function initLifecycle (Vue) { } } }) -} +} -- GitLab