RouterVo.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace ZR.Model.System.Vo
  6. {
  7. /// <summary>
  8. /// 路由展示
  9. /// </summary>
  10. public class RouterVo
  11. {
  12. [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
  13. public bool AlwaysShow { get; set; }
  14. private string component;
  15. [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
  16. public bool Hidden { get; set; }
  17. public string Name { get; set; }
  18. public string Path { get; set; }
  19. public string Redirect { get; set; }
  20. public Meta Meta { get; set; }
  21. [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
  22. public List<RouterVo> Children { get; set; }
  23. public string Component { get => component; set => component = value; }
  24. }
  25. public class Meta
  26. {
  27. /// <summary>
  28. /// 设置该路由在侧边栏和面包屑中展示的名字
  29. /// </summary>
  30. public string Title { get; set; }
  31. /// <summary>
  32. /// 设置该路由的图标,对应路径src/assets/icons/svg
  33. /// </summary>
  34. public string Icon { get; set; }
  35. /// <summary>
  36. /// 设置为true,则不会被 <keep-alive>缓存
  37. /// </summary>
  38. public bool NoCache { get; set; }
  39. public string TitleKey { get; set; } = string.Empty;
  40. public string Link { get; set; } = string.Empty;
  41. public Meta(string title, string icon)
  42. {
  43. Title = title;
  44. Icon = icon;
  45. }
  46. public Meta(string title, string icon, string path)
  47. {
  48. Title = title;
  49. Icon = icon;
  50. Link = path;
  51. }
  52. public Meta(string title, string icon, bool noCache, string titleKey, string path)
  53. {
  54. Title = title;
  55. Icon = icon;
  56. NoCache = noCache;
  57. TitleKey = titleKey;
  58. if (!string.IsNullOrEmpty(path) && (path.StartsWith(UserConstants.HTTP) || path.StartsWith(UserConstants.HTTPS)))
  59. {
  60. Link = path;
  61. }
  62. }
  63. }
  64. }