riku
2024-11-19 71030e1f80635b7332136a488bc2cc8bd36fc04c
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
<template>
  <el-popover :visible="modelValue" placement="top" :width="160">
    <p>{{ msg }}</p>
    <div style="text-align: right; margin: 0">
      <el-button size="small" text @click="handleCancel">取消</el-button>
      <el-button size="small" type="primary" @click="handleConfirm">确认</el-button>
    </div>
    <template #reference>
      <!-- <slots-events @click="visible = true"> -->
      <slot></slot>
      <!-- </slots-events> -->
    </template>
  </el-popover>
</template>
<script>
/**
 * 二次确认按钮
 */
export default {
  props: {
    modelValue: Boolean,
    msg: {
      type: String,
      default: '确认操作?'
    }
  },
  emits: ['confirm', 'cancel', 'update:modelValue'],
  data() {
    return {
      // visible: false
    };
  },
  methods: {
    handleConfirm() {
      // this.visible = false;
      this.$emit('confirm');
      this.$emit('update:modelValue', false);
    },
    handleCancel() {
      // this.visible = false;
      this.$emit('cancel');
      this.$emit('update:modelValue', false);
    }
  }
};
</script>