index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="create">
  3. <div class="create-left">
  4. <div class="back-container">
  5. <el-button class="back" @click="back"><i class="el-icon-arrow-left"></i> 返回</el-button>
  6. <span class="title">Frame 1</span>
  7. </div>
  8. <div v-for="{ value, label, children } in bookTypeOption" :key="value" class="components">
  9. <div class="components-title">{{ label }}</div>
  10. <div
  11. v-for="{ value: childValue, icon, label: childLabel } in children"
  12. :key="childValue"
  13. class="components-item"
  14. @click="curType = childValue"
  15. >
  16. <SvgIcon v-if="icon" :icon-class="icon" />
  17. <span>{{ childLabel }}</span>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="create-middle">
  22. <div></div>
  23. <main ref="canvas" class="canvas">
  24. <component :is="componentList[curType]" ref="components" @showSetting="showSetting" />
  25. </main>
  26. </div>
  27. <div class="create-right">
  28. <div class="setting-tittle">设置</div>
  29. <component :is="componentSettingList[curType]" ref="setting" @updateSetting="updateSetting" />
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import { bookTypeOption, componentList, componentSettingList } from '../data/bookType';
  35. export default {
  36. name: 'CreatePage',
  37. data() {
  38. return {
  39. curType: 'divider',
  40. componentList,
  41. componentSettingList,
  42. bookTypeOption,
  43. };
  44. },
  45. methods: {
  46. back() {
  47. this.$router.push('/');
  48. },
  49. showSetting(setting) {
  50. this.$refs.setting.setSetting(setting);
  51. },
  52. updateSetting(setting) {
  53. this.$refs.components.updateSetting(setting);
  54. },
  55. },
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. .create {
  60. display: flex;
  61. height: 100%;
  62. &-left {
  63. display: flex;
  64. flex-direction: column;
  65. width: 200px;
  66. overflow: auto;
  67. background-color: #fff;
  68. .back-container {
  69. display: flex;
  70. flex-direction: column;
  71. row-gap: 8px;
  72. padding: 4px;
  73. .back {
  74. color: #000;
  75. text-align: left;
  76. background-color: #f4f4f4;
  77. }
  78. .title {
  79. padding: 0 16px;
  80. font-size: 14px;
  81. font-weight: bold;
  82. }
  83. }
  84. .components {
  85. display: flex;
  86. flex-direction: column;
  87. padding: 24px 8px 4px;
  88. margin-top: 12px;
  89. border-top: 1px solid #e5e6eb;
  90. .components-title {
  91. padding-left: 8px;
  92. font-size: 14px;
  93. font-weight: bold;
  94. color: #999;
  95. }
  96. .components-item {
  97. display: flex;
  98. align-items: center;
  99. padding: 5px 16px;
  100. cursor: pointer;
  101. svg {
  102. width: 16px;
  103. height: 16px;
  104. margin-right: 8px;
  105. }
  106. }
  107. }
  108. }
  109. &-middle {
  110. flex: 1;
  111. padding: 24px 20px;
  112. overflow: auto;
  113. background-color: #ececec;
  114. .canvas {
  115. width: 100%;
  116. min-height: 100%;
  117. padding: 24px;
  118. background-color: #fff;
  119. border-radius: 4px;
  120. }
  121. }
  122. &-right {
  123. width: 200px;
  124. padding: 16px 8px;
  125. background-color: #fff;
  126. .setting-tittle {
  127. margin-bottom: 16px;
  128. font-weight: bold;
  129. color: #000;
  130. }
  131. }
  132. }
  133. </style>