Skip to main content

oncancel

Description

Sets the function that closes a popup

Usage

oncancel?: (ev: MouseEvent) => void;

Parameters

  • ev - the event object associated with the cancel action

Example

<script setup>
import { ref } from "vue";
import { Button, Popup } from "@svar-ui/vue-core";

const showPopup = ref(false);

function onclick() {
showPopup.value = true;
}

function oncancel() {
showPopup.value = false;
}
</script>

<template>
<div>
<Button :onclick="onclick">Show Popup</Button>
</div>

<Popup v-if="showPopup" :onclick="onclick" :oncancel="oncancel">
<div class="popup">
<p>Some text here and there</p>
</div>
</Popup>
</template>

Related article: Showing/hiding Popup

Related sample: Popup