Skip to content

Dialog 对话框

用于弹出窗口

按需引入方式

如果是完整引入可跳过此步骤

javascript
import Vue from 'vue'
import { Dialog } from 'element-ui'
import 'element-ui/lib/theme-chalk/base.css'
import 'element-ui/lib/theme-chalk/dialog.css'

Vue.use(Dialog)

基础使用

vue
<template>
    <el-button @click="dialogVisible = true">点击打开 Dialog</el-button>

    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
        <span>这是一段信息</span>
        <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="dialogVisible = false"
                >确 定</el-button
            >
        </span>
    </el-dialog>
</template>

<script>
export default {
    data() {
        return {
            dialogVisible: false
        }
    }
}
</script>

Attributes

参数说明类型默认值
visible是否显示 Dialogbooleanfalse
title标题string
widthDialog 的宽度string50%
...