-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathInternalDescDrawer.vue
More file actions
100 lines (91 loc) · 2.6 KB
/
InternalDescDrawer.vue
File metadata and controls
100 lines (91 loc) · 2.6 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<template>
<el-drawer v-model="visibleInternalDesc" size="60%" :append-to-body="true">
<template #header>
<div class="flex align-center" style="margin-left: -8px">
<el-button class="cursor mr-4" link @click.prevent="visibleInternalDesc = false">
<el-icon :size="20">
<Back />
</el-icon>
</el-button>
<h4>详情</h4>
</div>
</template>
<div>
<div class="card-header">
<div class="flex-between">
<div class="title flex align-center">
<AppAvatar
v-if="isAppIcon(functionDetail?.icon)"
shape="square"
:size="64"
style="background: none"
class="mr-8"
>
<img :src="functionDetail?.icon" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="functionDetail?.name"
:name="functionDetail?.name"
pinyinColor
shape="square"
:size="64"
class="mr-8"
/>
<div class="ml-16">
<h3 class="mb-8">{{ functionDetail.name }}</h3>
<el-text type="info" v-if="functionDetail?.desc">
{{ functionDetail.desc }}
</el-text>
</div>
</div>
<div @click.stop>
<el-button type="primary" @click="addInternalFunction(functionDetail)">
{{ $t('common.add') }}
</el-button>
</div>
</div>
<div class="mt-16">
<el-text type="info">
<div>{{ $t('common.author') }}: MaxKB</div>
</el-text>
</div>
</div>
<MdPreview
ref="editorRef"
editorId="preview-only"
:modelValue="markdownContent"
style="background: none"
noImgZoomIn
/>
</div>
</el-drawer>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { cloneDeep } from 'lodash'
import { isAppIcon } from '@/utils/application'
const emit = defineEmits(['refresh', 'addFunction'])
const visibleInternalDesc = ref(false)
const markdownContent = ref('')
const functionDetail = ref<any>({})
watch(visibleInternalDesc, (bool) => {
if (!bool) {
markdownContent.value = ''
}
})
const open = (data: any, detail: any) => {
functionDetail.value = detail
if (data) {
markdownContent.value = cloneDeep(data)
}
visibleInternalDesc.value = true
}
const addInternalFunction = (data: any) => {
emit('addFunction', data)
visibleInternalDesc.value = false
}
defineExpose({
open
})
</script>
<style lang="scss"></style>