123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <template>
- <div class="dialog-main">
- <el-dialog :title="title" :visible.sync="visible">
- <slot />
- <span slot="footer" class="dialog-footer">
- <el-button @click="cancel()">取 消</el-button>
- <el-button type="primary" @click="confirm()">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- export default {
- props: {
- title: {
- type: String,
- default: '',
- required: false
- },
- showDialog: {
- type: Boolean,
- default: false,
- required: true
- }
- },
- data() {
- return {
- visible: this.showDialog
- }
- },
- watch: {
- showDialog() {
- this.visible = this.showDialog
- }
- },
- methods: {
- confirm() {
- this.$emit('confirm', true)
- },
- cancel() {
- this.$emit('cancel', false)
- }
- }
- }
- </script>
|