vue
copy
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>
import { ref } from "vue";

setup() {
  const modal = ref();
  const modalConfig = ref({});
  
  const open = () => {
    modalConfig.value = {
      title: "Are you sure you want to delete it?",
      description:
        "If you delete it there is no step back, it will be permanently deleted",
      confirmButtonText: "Yes, delete it",
      cancelButtonText: "No, keep it",
      icon: "warning",
    };
    modal.value.openModal();
  };
  
  const accept = () => {
    console.log("accept");
  };

  const cancel = () => {
    console.log("cancel");
  };
}

</script>
<tv-modal
  :config-modal="modalConfig"
  @accept-modal="accept"
  @cancel-modal="cancel"
  ref="modal"
/>