ModuleBase.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div class="module">
  3. <div class="module-top">
  4. <span class="title">{{ componentNameList[type] }}</span>
  5. <div class="module-icon">
  6. <span><SvgIcon icon-class="copy" size="10" /></span>
  7. <span :class="[{ active: getCurSettingId() === id }]" @click="showSetting">
  8. <SvgIcon icon-class="setup" size="10" />
  9. </span>
  10. <span><SvgIcon icon-class="delete" size="10" /></span>
  11. </div>
  12. </div>
  13. <div class="module-content">
  14. <slot name="content"></slot>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import { componentNameList } from '@/views/book/courseware/data/bookType.js';
  20. export default {
  21. name: 'ModuleBase',
  22. inject: ['id', 'showSetting', 'getCurSettingId'],
  23. props: {
  24. type: {
  25. type: String,
  26. default: 'text',
  27. },
  28. },
  29. data() {
  30. return {
  31. componentNameList,
  32. };
  33. },
  34. };
  35. </script>
  36. <style lang="scss" scoped>
  37. .module {
  38. padding: 8px;
  39. border: 1px solid #ebebeb;
  40. &-top {
  41. display: flex;
  42. justify-content: space-between;
  43. margin-bottom: 3px;
  44. .title {
  45. font-size: 12px;
  46. color: $label-color;
  47. }
  48. }
  49. &-icon {
  50. display: flex;
  51. column-gap: 8px;
  52. span {
  53. display: flex;
  54. align-items: center;
  55. justify-content: center;
  56. width: 16px;
  57. height: 16px;
  58. cursor: pointer;
  59. background-color: #fff;
  60. border-radius: 20px;
  61. &.active {
  62. background-color: #c9c9c9;
  63. }
  64. .svg-icon.setup {
  65. color: #000;
  66. }
  67. .svg-icon.delete {
  68. color: #ed4646;
  69. }
  70. }
  71. }
  72. &-content {
  73. padding: 8px;
  74. background-color: #fff;
  75. }
  76. }
  77. </style>