selectShop.js 674 B

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