Riku
2025-07-13 4b275f2093954cc58bbc23e4fc67e67d6fe81c0b
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
<template>
  <CardDialog
    :title="title"
    :model-value="modelValue"
    @update:modelValue="handleChange"
    :width="400"
  >
    <el-row justify="center">
      <div class="m-v-16">{{ msg }}</div>
    </el-row>
    <template #footer>
      <el-row justify="end">
        <el-button type="primary" class="el-button-custom" @click="cancel">
          {{ cancelText }}
        </el-button>
        <el-button
          type="danger"
          class="el-button-custom-light"
          @click="confirm"
        >
          {{ confirmText }}
        </el-button>
      </el-row>
    </template>
  </CardDialog>
</template>
<script>
export default {
  props: {
    title: String,
    msg: String,
    modelValue: Boolean,
    confirmText: {
      type: String,
      default: '确认'
    },
    cancelText: {
      type: String,
      default: '取消'
    },
    onConfirm: Function,
    onCancel: Function
  },
  data() {},
  emits: ['update:modelValue'],
  methods: {
    handleChange(value) {
      this.$emit('update:modelValue', value);
    },
    confirm() {
      if (this.onConfirm) {
        this.onConfirm();
      }
      this.$emit('update:modelValue', false);
    },
    cancel() {
      if (this.onCancel) {
        this.onCancel();
      }
      this.$emit('update:modelValue', false);
    }
  }
};
</script>