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: { + + } +});