12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <div class="module">
- <div class="module-top">
- <span class="title">{{ componentNameList[type] }}</span>
- <div class="module-icon">
- <span><SvgIcon icon-class="copy" size="10" /></span>
- <span :class="[{ active: getCurSettingId() === id }]" @click="showSetting">
- <SvgIcon icon-class="setup" size="10" />
- </span>
- <span @click="deleteComponent"><SvgIcon icon-class="delete" size="10" /></span>
- </div>
- </div>
- <div class="module-content">
- <slot name="content"></slot>
- </div>
- </div>
- </template>
- <script>
- import { componentNameList } from '@/views/book/courseware/data/bookType.js';
- export default {
- name: 'ModuleBase',
- inject: ['id', 'showSetting', 'getCurSettingId'],
- props: {
- type: {
- type: String,
- default: 'text',
- },
- },
- data() {
- return {
- componentNameList,
- };
- },
- methods: {
- deleteComponent() {
- this.$emit('deleteComponent');
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .module {
- padding: 8px;
- background-color: #fff;
- border: 1px solid #ebebeb;
- &-top {
- display: flex;
- justify-content: space-between;
- margin-bottom: 3px;
- .title {
- font-size: 12px;
- color: $label-color;
- }
- }
- &-icon {
- display: flex;
- column-gap: 8px;
- span {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 16px;
- height: 16px;
- cursor: pointer;
- background-color: #fff;
- border-radius: 20px;
- &.active {
- background-color: #c9c9c9;
- }
- .svg-icon.setup {
- color: #000;
- }
- .svg-icon.delete {
- color: #ed4646;
- }
- }
- }
- &-content {
- padding: 8px;
- background-color: #fff;
- }
- }
- </style>
|