index.vue 911 Bytes
Newer Older
1
<template>
2 3
    <a-popconfirm :title="title" ok-text="确认" cancel-text="取消" @confirm="confirm">
        <a>{{ label }}</a>
4 5 6 7 8
    </a-popconfirm>
</template>

<script>
import { EMPTY_FUN } from '@/utils';
水落(YangLei)'s avatar
水落(YangLei) committed
9
import { delReq } from '@/utils';
10 11 12

export default {
    props: {
水落(YangLei)'s avatar
水落(YangLei) committed
13 14
        url: String,
        cb: {
15 16 17
            type: Function,
            default: EMPTY_FUN,
        },
18 19 20 21
        title: {
            type: String,
            default: '确认是否删除',
        },
22 23 24 25 26 27 28 29
        onOk: {
            type: Function,
            default: EMPTY_FUN,
        },
        label: {
            type: String,
            default: '删除',
        },
30
    },
水落(YangLei)'s avatar
水落(YangLei) committed
31
    methods: {
32 33 34 35 36 37 38
        async confirm() {
            if (this.url) {
                await delReq(this.url);
            }
            if (this.onOk) {
                await this.onOk();
            }
39
            this?.cb();
水落(YangLei)'s avatar
水落(YangLei) committed
40 41
        },
    },
42 43
};
</script>