oncancel
Description
Fires on click of the Cancel button or when the ESC key is pressedUsage
oncancel?: (ev: { button?: string; ev: MouseEvent }) => void;
Parameters
The callback of the event takes an object with the following parameter:
button- (optional) the value is "cancel" if the event fires on the Cancel button clickev- the native MouseEvent of the click
The event also fires on pressing ESC, the callback function takes a native HTML event object.
Example
<script setup>
import { ref } from "vue";
import { Modal, Text, Portal, Button } from "@svar-ui/vue-core";
const custom1 = ref(false);
function hideAll() {
custom1.value = false;
}
</script>
<template>
<Portal v-if="custom1">
<Modal title="Custom Prompt" :oncancel="hideAll">
<Text :select="true" :focus="true" value="Some" />
</Modal>
</Portal>
</template>
Related article: Providing the buttons' functionality
Related sample: Messages