ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
<script lang="ts" setup>
import { computed, unref } from 'vue';
 
import { useAttrs, useMessage } from '@jnpf/hooks';
 
import { $t } from '@vben/locales';
 
import { omit } from 'lodash-es';
 
defineOptions({ inheritAttrs: false });
 
const props = defineProps({
  modelConfirm: { type: Object },
});
 
const attrs = useAttrs({ excludeDefaultKeys: false });
const { createConfirm } = useMessage();
const { modelConfirm } = props;
function onClick() {
  createConfirm({
    content: modelConfirm?.content || $t('common.delTip'),
    iconType: modelConfirm?.iconType || 'warning',
    onOk: modelConfirm?.onOk,
    title: modelConfirm?.title || $t('common.tipTitle'),
  });
}
const getBindValue = computed(() => omit({ ...unref(attrs) }, ['enable', 'getPopupContainer', 'label', 'onClick', 'icon']));
</script>
<template>
  <a-button v-bind="getBindValue" @click="onClick">
    <template #default="data">
      <slot v-bind="data || {}"></slot>
    </template>
  </a-button>
</template>