city.js 523B

12345678910111213141516171819202122232425262728293031
  1. import {
  2. CITY_LIST,
  3. CITY_SELECTED
  4. } from '@/constants/city'
  5. const INITIAL_STATE = {
  6. cityList: {},
  7. curCity: {}
  8. }
  9. export default function news(state = INITIAL_STATE, action) {
  10. switch (action.type) {
  11. case CITY_LIST: {
  12. // console.log(action.payload, "!!action.payload!!")
  13. return {
  14. ...state,
  15. cityList: action.payload
  16. }
  17. }
  18. case CITY_SELECTED: {
  19. return {
  20. ...state,
  21. curCity: action.payload
  22. }
  23. }
  24. default:
  25. return state
  26. }
  27. }