index.vue
1.28 KB
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
63
64
<style rel="stylesheet/scss" lang="scss">
.eagle-confirm-icon {
margin-right: 5px;
font-size: 16px;
color: #faad14;
}
.eagle-confirm-title {
font-size: 14px;
margin: 0px 0px 5px 0px;
}
.eagle-confirm-button-panel {
margin: 0;
text-align: right;
}
</style>
<template>
<el-popover :placement="placement" :trigger="trigger" v-model="visible">
<div>
<p class="eagle-confirm-title">
<i class="el-icon-info eagle-confirm-icon"></i>
<span>{{ title }}</span>
</p>
<p class="eagle-confirm-button-panel">
<el-button size="mini" plain @click="cancel">否</el-button>
<el-button size="mini" type="primary" style="margin-left: 5px" @click="confirm">是</el-button>
</p>
</div>
<span @click.stop slot="reference">
<slot></slot>
</span>
</el-popover>
</template>
<script>
export default {
name: "Confirm",
props: {
title: {
type: String,
default: "是否执行当前操作?"
},
placement: {
type: String,
default: "top"
},
trigger: String
},
data() {
return {
visible: false
}
},
methods: {
cancel() {
this.visible = false
this.$emit("cancel")
},
confirm() {
this.visible = false
this.$emit("confirm")
}
}
}
</script>