You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.2 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="p-5 space-y-5 !bg-gray-100">
<el-card header="动态调整element-plus弹窗dialog的大小示例">
<el-button
type="primary"
@click="showDialog = true"
>
点击弹出dialog
</el-button>
<!-- resize局部自定义指令用法 -->
<!-- 这里必须使用v-show否则无法触发自定义指令里面的updated -->
<div
v-show="showDialog"
v-resize
>
<!-- destroy-on-close必须不然下次打开无法还原为初始化大小 -->
<el-dialog
v-model="showDialog"
:width="800"
title="dialog弹窗标题"
:draggable="true"
destroy-on-close
>
<p>这是一个dialog弹窗</p>
<p>可以通过拖拽改变弹窗大小</p>
<p>可以通过点击右上角关闭弹窗</p>
<p>这是一个dialog弹窗</p>
<p>可以通过拖拽改变弹窗大小</p>
<p>可以通过点击右上角关闭弹窗</p>
<p>这是一个dialog弹窗</p>
<p>可以通过拖拽改变弹窗大小</p>
<p>可以通过点击右上角关闭弹窗</p>
</el-dialog>
</div>
</el-card>
<el-card header="directives/resize代码详解文档">
<div
class="markdown-body"
v-html="htmlStr"
/>
</el-card>
</div>
</template>
<script setup>
import { ref } from 'vue';
import { marked } from 'marked';
import { getMarkdownContent } from '@/utils/tools';
// directives/resize局部自定义指令注入必须使用vXXXX这种格式例如vFoucs,vResize等
import resize from './directives/resize';
const vResize = resize;
const showDialog = ref(false);
// markdown文档
const htmlStr = ref('');
getMarkdownContent('./md/resizeElementDialog.md').then((res) => {
htmlStr.value = marked(res);
});
</script>