cart.vue
getData(){ this.updateCartList() } mounted(){ this.getData() uni.$on('updateCart',()=>{ console.log('42423423'); this.getData() }) },
detail.vue中添加
app.vue
cart.js
dodelgoods({ commit, state }) { $H({ url: '/cart/delete', method:'POST', data: { shop_ids: state.selectedAll.join(',') }, header: { token: true } }).then(res => { console.log(res); }) commit('delgoods') },
cart.vue
app.vue
清空购物车
myfile.vue
初始化页面
login页面
角标
export default{ updateBadge(count){ if(count>0){ uni.setTabBarBadge({ index: 2, text: count.toString() }) } } }
import $U from '@/common/lib/badge.js'