selectShop.js 706 B

1234567891011121314151617181920212223242526272829303132333435363738
  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=>({
  24. ...i,
  25. name:i.shopName
  26. }));
  27. },
  28. watch:{
  29. userShopAll (val) {
  30. if(!this.$util.isEmpty(val)) {
  31. this.menuObj.list = val.map(i=>({
  32. ...i,
  33. name:i.shopName
  34. }));
  35. }
  36. }
  37. }
  38. }