- 优化 productcard.vue 图片url取得是 array
- 订单url地址选择 未完成
This commit is contained in:
6
mobile-web/src/page/eventBus.js
Normal file
6
mobile-web/src/page/eventBus.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
/**
|
||||
* 定义空的vue实例,作为 eventbus实现非父子组件之间的通信(vue2.x中去掉了broadcast)
|
||||
*/
|
||||
export default new Vue({});
|
||||
@@ -57,6 +57,7 @@
|
||||
<script>
|
||||
|
||||
import {createOrder} from '../../api/order';
|
||||
import eventBus from '../eventBus';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -122,10 +123,18 @@
|
||||
|
||||
|
||||
activated() {
|
||||
|
||||
console.log('activated')
|
||||
//根据key名获取传递回来的参数,data就是map
|
||||
this.$on('selectAddress', function (data) {
|
||||
// eventBus.$on('selectaddress', function(data){
|
||||
// //赋值给首页的附近医院数据模型
|
||||
// console.log('selectaddress', data);
|
||||
// }.bind(this));
|
||||
|
||||
//根据key名获取传递回来的参数,data就是map
|
||||
this.$on('selectaddress', function (data) {
|
||||
//赋值给首页的附近医院数据模型
|
||||
console.log(1);
|
||||
console.log('selectaddress', data);
|
||||
}.bind(this));
|
||||
},
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
hasDefault: data.isDefault,
|
||||
};
|
||||
|
||||
if (data.id !== 0) {
|
||||
if (data.id) {
|
||||
UpdateAddress(params).then(response => {
|
||||
this.$toast('更新成功');
|
||||
this.$router.go(-1);
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
<script>
|
||||
|
||||
import {GetAddressList} from "../../../api/user.js";
|
||||
import {AddressList} from 'vant';
|
||||
import { AddressList } from 'vant';
|
||||
import eventBus from '../../eventBus';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -42,7 +43,9 @@
|
||||
if (!this.isSelect) {
|
||||
return;
|
||||
}
|
||||
this.$emit('selectAddress', item);
|
||||
this.$emit('selectaddress', item);
|
||||
//传递一个map,choiceHospital是key,hospital是value
|
||||
// eventBus.$emit('selectaddress',item);
|
||||
this.$router.go(-1);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user