MenuIcon.vue 876 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <view class="menu-icon" :style="{ background: bg, color: color }">{{ char }}</view>
  3. </template>
  4. <script>
  5. import {
  6. resolveMenuIcon
  7. } from "./menu-icon";
  8. export default {
  9. name: "MenuIcon",
  10. props: {
  11. // 菜单名称(如「离职交接单」「保养工单」),接口新增菜单无需配置即可自动出图
  12. name: {
  13. type: String,
  14. default: "",
  15. },
  16. },
  17. computed: {
  18. icon() {
  19. return resolveMenuIcon(this.name);
  20. },
  21. char() {
  22. return this.icon.char;
  23. },
  24. color() {
  25. return this.icon.color;
  26. },
  27. bg() {
  28. return this.icon.bg;
  29. },
  30. },
  31. };
  32. </script>
  33. <style lang="scss" scoped>
  34. .menu-icon {
  35. width: 88rpx;
  36. height: 88rpx;
  37. border-radius: 20rpx;
  38. display: flex;
  39. align-items: center;
  40. justify-content: center;
  41. font-size: 44rpx;
  42. font-weight: 600;
  43. line-height: 1;
  44. margin-bottom: 12rpx;
  45. }
  46. </style>