selectShop.js 641 B

1234567891011121314151617181920212223242526
  1. import { mapState,mapGetters } from 'vuex'
  2. export default {
  3. data(){
  4. return {
  5. menuObj:{ title:'门店', titleChild:'请选择门店', list: [] },
  6. shopId:0
  7. }
  8. },
  9. computed:{
  10. ...mapState({
  11. userShopAll:state=>state.user.userShopAll
  12. }),
  13. ...mapGetters({
  14. loginInfo: "getLoginInfo",
  15. userInfo: 'getUser'
  16. })
  17. },
  18. mounted () {
  19. this.menuObj.list = this.userShopAll.map(i=>({ ...i, name:i.shopName }))
  20. },
  21. watch:{
  22. userShopAll (val) {
  23. if(!this.$util.isEmpty(val)) { this.menuObj.list = val.map(i=>({ ...i, name:i.shopName })); }
  24. }
  25. }
  26. }