const map =newMap()
map.set('1','basketball')
map.set('2','soccer')
map.set('3','baseball')
map.set('4','tennis')
const obj = Array.from(你的Map).reduce((obj, [key, value]) =>
Object.assign(obj, { [key]: value} )
, {})
obj就是js对象了
以key value的形式传参
let cardId = this.cardId;
var shopGoodsData = new Map();
shopGoodsData.set(cardId, 1);
const obj = Array.from(shopGoodsData).reduce((obj, [key, value]) =>
Object.assign(obj, { [key]: value} )
, {})
let params = {
shopGoodsData: JSON.stringify(obj), //样式 shopGoodsData: "x" :1
payMode: 'xs_wx_pay_app',
type: 2,
remark: '',
isShop: false,
userId: this.userId
};
shopGoods(params).then(res => {}