|
12 | 12 | v-for="(child, cIndex) in paragraph_list" |
13 | 13 | :key="cIndex" |
14 | 14 | shadow="never" |
15 | | - class="card-never mb-16" |
| 15 | + class="paragraph-preview-card card-never mb-16" |
| 16 | + @mouseenter="cardEnter(cIndex)" |
| 17 | + @mouseleave="cardLeave()" |
16 | 18 | > |
17 | | - <div class="flex-between"> |
18 | | - <span>{{ child.title || '-' }}</span> |
19 | | - <div> |
| 19 | + <div v-show="show === cIndex" class="mk-sticky"> |
| 20 | + <el-card |
| 21 | + class="paragraph-box-operation mt-8 mr-8" |
| 22 | + shadow="always" |
| 23 | + style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px" |
| 24 | + @click.stop |
| 25 | + > |
20 | 26 | <!-- 编辑分段按钮 --> |
21 | 27 | <el-button link @click="editHandle(child, cIndex)"> |
22 | 28 | <AppIcon iconName="app-edit"></AppIcon> |
|
25 | 31 | <el-button link @click="deleteHandle(child, cIndex)"> |
26 | 32 | <AppIcon iconName="app-delete"></AppIcon> |
27 | 33 | </el-button> |
28 | | - </div> |
| 34 | + </el-card> |
| 35 | + </div> |
| 36 | + <div class="flex-between"> |
| 37 | + <span>{{ child.title || '-' }}</span> |
29 | 38 | </div> |
30 | 39 | <div class="lighter mt-12"> |
31 | 40 | {{ child.content }} |
| 41 | + <MdPreview |
| 42 | + ref="editorRef" |
| 43 | + editorId="preview-only" |
| 44 | + :modelValue="child.content" |
| 45 | + class="maxkb-md" |
| 46 | + style="background: none" |
| 47 | + /> |
32 | 48 | </div> |
33 | 49 | <div class="lighter mt-12"> |
34 | 50 | <el-text type="info"> |
@@ -90,6 +106,15 @@ const paragraph_list = computed(() => { |
90 | 106 | return localParagraphList.value |
91 | 107 | }) |
92 | 108 |
|
| 109 | +const show = ref<number | null>(null) |
| 110 | +function cardEnter(cIndex: number) { |
| 111 | + show.value = cIndex |
| 112 | +} |
| 113 | +
|
| 114 | +function cardLeave() { |
| 115 | + show.value = null |
| 116 | +} |
| 117 | +
|
93 | 118 | const next = () => { |
94 | 119 | if (loading.value) return |
95 | 120 | loading.value = true |
@@ -154,4 +179,23 @@ const deleteHandle = (item: any, cIndex: number) => { |
154 | 179 | .catch(() => {}) |
155 | 180 | } |
156 | 181 | </script> |
157 | | -<style lang="scss" scoped></style> |
| 182 | +<style lang="scss" scoped> |
| 183 | +.paragraph-preview-card { |
| 184 | + position: relative; |
| 185 | + .mk-sticky { |
| 186 | + height: 0; |
| 187 | + position: sticky; |
| 188 | + right: 0; |
| 189 | + top: 12px; |
| 190 | + overflow: inherit; |
| 191 | + z-index: 10; |
| 192 | + } |
| 193 | + .paragraph-box-operation { |
| 194 | + position: absolute; |
| 195 | + right: -10px; |
| 196 | + top: -20px; |
| 197 | + overflow: inherit; |
| 198 | + z-index: 10; |
| 199 | + } |
| 200 | +} |
| 201 | +</style> |
0 commit comments