41 lines
963 B
Vue
41 lines
963 B
Vue
<!-- 全局封装dialog组件 -->
|
|
<template>
|
|
<el-dialog
|
|
v-model="dialogVisible"
|
|
:title="dialogTitle"
|
|
width="50%"
|
|
:before-close="handleClose"
|
|
:draggable="true"
|
|
:destroy-on-close="true"
|
|
:append-to-body="true"
|
|
>
|
|
<div class="container">
|
|
<slot name="container"></slot>
|
|
</div>
|
|
<template #footer>
|
|
<div class="dialog-footer">
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
<el-button type="primary" @click="dialogVisible = false">
|
|
确定
|
|
</el-button>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
const dialogVisible = ref<Boolean>(false);
|
|
const dialogTitle = ref<string>("");
|
|
const openDialog = (title: string) => {
|
|
dialogTitle.value = title;
|
|
console.log(dialogVisible.value);
|
|
dialogVisible.value = true;
|
|
};
|
|
defineExpose({
|
|
openDialog,
|
|
});
|
|
onMounted(() => {
|
|
console.log();
|
|
});
|
|
</script>
|
|
<style lang="scss" scoped></style>
|