-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathMdEditorMagnify.vue
68 lines (65 loc) · 1.68 KB
/
MdEditorMagnify.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
<MdEditor
v-bind="$attrs"
v-model="data"
:preview="false"
:toolbars="[]"
class="magnify-md-editor"
:footers="footers"
>
<template #defFooters>
<el-button text type="info" @click="openDialog">
<AppIcon class="color-secondary" iconName="app-magnify" style="font-size: 16px"></AppIcon>
</el-button>
</template>
</MdEditor>
<!-- 回复内容弹出层 -->
<el-dialog v-model="dialogVisible" :title="title" append-to-body align-center>
<MdEditor v-model="cloneContent" :preview="false" :toolbars="[]" :footers="[]"></MdEditor>
<template #footer>
<div class="dialog-footer mt-24">
<el-button type="primary" @click="submitDialog"> {{ $t('common.confirm') }}</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
defineOptions({ name: 'MdEditorMagnify' })
const props = defineProps<{
title: String
modelValue: any
}>()
const emit = defineEmits(['update:modelValue', 'submitDialog'])
const data = computed({
set: (value) => {
emit('update:modelValue', value)
},
get: () => {
return props.modelValue
}
})
const dialogVisible = ref(false)
watch(dialogVisible, (bool) => {
if (!bool) {
emit('submitDialog', cloneContent.value)
}
})
const cloneContent = ref('')
const footers: any = [null, '=', 0]
function openDialog() {
cloneContent.value = props.modelValue
dialogVisible.value = true
}
function submitDialog() {
emit('submitDialog', cloneContent.value)
dialogVisible.value = false
}
</script>
<style lang="scss" scoped>
.magnify-md-editor {
:deep(.md-editor-footer) {
border: none !important;
}
}
</style>