wujingjing
2024-10-08 6869f6a6d3f095fee026fa384c14dd19d35b09db
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
<template>
    <ywDialog
        v-model="dialogIsShow"
        :title="dialogTitle"
        width="50%"
        @dlgClosed="closeDialog"
        :showHeaderIcon="false"
        :showFooter="false"
    >
        <div style="height: 600px" class="relative">
            <codemirror
                class="overflow-auto"
                style="height: 600px"
                :modelValue="item.sql"
                :autofocus="true"
                :indent-with-tab="true"
                :tab-size="2"
                :extensions="sqlEditorExtensions"
                
            />
            <i
                @click="copyInfo(item.sql)"
                class="ywifont ywicon-copy text-blue-400 !text-[25px] cursor-pointer absolute bottom-10 right-10"
            ></i>
        </div>
    </ywDialog>
</template>
 
<script setup lang="ts">
import ywDialog from '/@/components/dialog/yw-dialog.vue';
 
import { sql } from '@codemirror/lang-sql';
import { vscodeDark } from '@uiw/codemirror-theme-vscode';
import { computed } from 'vue';
import { Codemirror } from 'vue-codemirror';
import commonFunction from '/@/utils/commonFunction';
import { ElMessage } from 'element-plus';
 
const sqlEditorExtensions = [sql(), vscodeDark];
const dialogIsShow = defineModel({
    type: Boolean,
});
const closeDialog = () => {
    dialogIsShow.value = false;
};
const dialogTitle = computed(() => {
    return props.item?.id;
});
const props = defineProps(['item']);
 
const { copyText } = commonFunction();
 
const copyInfo = async (sql) => {
    copyText(sql);
};
</script>
<style scoped lang="scss"></style>