You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
709 B

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. import {defineStore} from 'pinia';
  2. const carStore = defineStore(
  3. 'car',
  4. {
  5. state: () => ({
  6. carInfo: {
  7. carType: 'car',//车型
  8. stepType: '1',//科目几
  9. carTypeName: '小车',
  10. contentType: '',//图片还是文字
  11. sift: '0', //是否精选
  12. volume: '0', //是否是密卷
  13. knowType: '',//分类
  14. chapter: '',//章节
  15. types: '',//题型
  16. },
  17. webLink: 'https://www.baidu.com/'
  18. }),
  19. actions: {
  20. setCar(key, value) {
  21. // 类型只选一个
  22. let arr = ['knowType', 'chapter', 'types']
  23. if(arr.includes(key)) {
  24. arr.forEach(item=>{
  25. this.carInfo[item] = ''
  26. })
  27. }
  28. this.carInfo[key] = value
  29. },
  30. }
  31. })
  32. export default carStore