# 对话框(Dialog)
# 基础用法
<template>
<div class="demo-dialog-wrap">
<el-dialog
title="标题"
class="demo-dialog"
width="1200px"
:visible.sync="dialogVisible"
>
<span>这是一段信息</span>
<span slot="footer" class="dialog-footer">
<el-button @click="close">取 消</el-button>
<el-button type="primary" @click="submit">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'DemoDialog',
props: {
isVisible: {
type: Boolean,
default: false,
},
dialogData: {
type: Object,
default: {},
}
},
data() {
return {
}
},
computed: {
dialogVisible: {
get() {
return this.isVisible;
},
set(newValue) {
this.$emit('update:isVisible', newValue);
}
}
},
created() {
this.init();
},
methods: {
init() {
},
close() {
this.dialogVisible = false;
this.$emit('cancel');
},
submit() {
this.close();
}
}
}
</script>
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
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