From dd452f81e6d46324a5f9ea580cc9d07daf85c9dd Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Wed, 10 Apr 2019 21:48:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=80=89=E6=8B=A9=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8=EF=BC=8C=E5=92=8C=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=B9=8B=E9=97=B4=E7=9A=84=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile-web/package.json | 3 +- mobile-web/src/page/shipping/order.vue | 35 +++++++++++------------ mobile-web/src/page/user/address/list.vue | 11 +++---- mobile-web/src/store/order.js | 23 +++++++++++++++ 4 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 mobile-web/src/store/order.js diff --git a/mobile-web/package.json b/mobile-web/package.json index f81d96511..4d1794fa6 100644 --- a/mobile-web/package.json +++ b/mobile-web/package.json @@ -12,7 +12,8 @@ "axios": "^0.18.0", "vant": "^1.3.1", "vue": "^2.5.17", - "vue-router": "^3.0.1" + "vue-router": "^3.0.1", + "vuex": "^3.1.0" }, "devDependencies": { "@vue/cli-plugin-babel": "^3.4.1", diff --git a/mobile-web/src/page/shipping/order.vue b/mobile-web/src/page/shipping/order.vue index 0b48584b8..3d9e495ee 100644 --- a/mobile-web/src/page/shipping/order.vue +++ b/mobile-web/src/page/shipping/order.vue @@ -12,8 +12,8 @@ 选择地址
@@ -57,12 +57,16 @@ diff --git a/mobile-web/src/page/user/address/list.vue b/mobile-web/src/page/user/address/list.vue index f3cc4f3d8..d4c975473 100644 --- a/mobile-web/src/page/user/address/list.vue +++ b/mobile-web/src/page/user/address/list.vue @@ -18,6 +18,7 @@ import {GetAddressList} from "../../../api/user.js"; import { AddressList } from 'vant'; import eventBus from '../../eventBus'; + import orderStore from '../../../store/order' export default { components: { @@ -43,9 +44,9 @@ if (!this.isSelect) { return; } - this.$emit('selectaddress', item); - //传递一个map,choiceHospital是key,hospital是value - // eventBus.$emit('selectaddress',item); + this.$store.commit('changeAddressData', { + ...item + }); this.$router.go(-1); } }, @@ -62,8 +63,8 @@ } }); }) - } - + }, + store: orderStore, } diff --git a/mobile-web/src/store/order.js b/mobile-web/src/store/order.js new file mode 100644 index 000000000..e5558b630 --- /dev/null +++ b/mobile-web/src/store/order.js @@ -0,0 +1,23 @@ +import Vue from 'vue' +import Vuex from 'vuex' + +Vue.use(Vuex); + +// 挂载 +export default new Vuex.Store({ + state: { + addressData: { + }, + }, + mutations: { + changeAddressData: function (state, payload) { + state.addressData = payload; + } + }, + actions: { + + }, + getters: { + + } +});