<script setup lang="ts">
// import { reactive } from 'vue';
import { useQuasar } from 'quasar';
import ICON from 'src/config/icons';
import CustomComponent from 'src/components/dialog-tip/DialogTip.vue';

import emitter from '../../eventbus';

const props = defineProps<{
  params: any;
}>();

const $q = useQuasar();

function delRow() {
  // const msg = `确定<strong>删除</strong>当前行<span class="text-warning text-weight-bold">${props.params.data.name}</span>？`;
  // $q.dialog({
  //   title: '<i class="bi bi-exclamation-circle text-warning"></i>&nbsp;提示',
  //   message: msg,
  //   cancel: true,
  //   persistent: true,
  //   html: true,
  // }).onOk(() => {
  //   emitter.emit('delRow', props.params);
  // });

  $q.dialog({
    component: CustomComponent,
    // props forwarded to your custom component
    componentProps: {
      // persistent: true,
      text: '数据已上传至云端，无法删除',
      color: 'warning',
      showActions: false,
      // ...more..props...
    },
  }).onOk(() => {
    emitter.emit('delRow', props.params);
  });
  // .onCancel(() => {
  //   console.log('Cancel');
  // })
  // .onDismiss(() => {
  //   console.log('Called on OK or Cancel');
  // });
}
</script>
<template>
  <div>
    <q-btn :icon="ICON.delete" round flat @click="delRow" size="11px" />
  </div>
</template>

<style lang="scss" scoped></style>
