Skip to main content

cancel

Description

Fires when closing the Month view after date selection

Usage

oncancel?: () => void;

Example

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

const value = ref(new Date());
const showMonth = ref(false);
const show = () => {
showMonth.value = true;
};
const onchange = ev => {
value.value = ev.value;
};
const oncancel = () => {
showMonth.value = false;
};
</script>

<template>
<div class="demo-box" style="width: 300px">
<div style="margin: 20px;">{{ value }}</div>
<div style="margin: 20px;">
<Button :onclick="show">Open month</Button>
</div>
<Month
v-if="showMonth"
:value="value"
part="normal"
:current="value"
:onchange="onchange"
:oncancel="oncancel" />
</div>
</template>