Item.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <script>
  2. import store from "@/store";
  3. export default {
  4. name: "MenuItem",
  5. functional: true,
  6. props: {
  7. icon: {
  8. type: String,
  9. default: "",
  10. },
  11. title: {
  12. type: String,
  13. default: "",
  14. },
  15. },
  16. render(h, context) {
  17. const { icon, title } = context.props;
  18. const vnodes = [];
  19. if (icon) {
  20. vnodes.push(<svg-icon icon-class={icon} />);
  21. }
  22. if (title) {
  23. if (title.length > 5) {
  24. vnodes.push(
  25. <span slot="title" title={title}>
  26. {title}
  27. </span>
  28. );
  29. } else {
  30. let inspectNum = store.getters.inspectNum; //评估考察
  31. let projectLXNum = store.getters.projectLXNum; //项目立项
  32. let dueNum = store.getters.dueNum; //尽职背调
  33. let projectTJNum = store.getters.projectTJNum; //项目投决
  34. vnodes.push(
  35. <span slot="title">
  36. {title}
  37. {title === "评估考察" && inspectNum ? (
  38. <span class="hint">{inspectNum}</span>
  39. ) : (
  40. ""
  41. )}
  42. {title === "项目立项" && projectLXNum ? (
  43. <span class="hint">{projectLXNum}</span>
  44. ) : (
  45. ""
  46. )}
  47. {title === "尽职背调" && dueNum ? (
  48. <span class="hint">{dueNum}</span>
  49. ) : (
  50. ""
  51. )}
  52. {title === "项目投决" && projectTJNum ? (
  53. <span class="hint">{projectTJNum}</span>
  54. ) : (
  55. ""
  56. )}
  57. </span>
  58. );
  59. }
  60. }
  61. return vnodes;
  62. },
  63. };
  64. </script>
  65. <style lang="scss" scoped>
  66. .hint {
  67. width: 16px;
  68. height: 16px;
  69. border-radius: 50%;
  70. background: #f8ac59;
  71. color: #fff;
  72. display: inline-block;
  73. line-height: 16px;
  74. text-align: center;
  75. margin-left: 5px;
  76. font-size: 12px;
  77. font-weight: bold;
  78. margin-top: -1px;
  79. }
  80. </style>