Skip to main content

cancel

Description

a function called on closing the Month view after date selection

Type

function

Example

<script>
import { Month, Button } from "wx-svelte-core";

let value = new Date();
let showMonth = false;
const show = () => {
showMonth = true;
};
const onchange = ev => {
value = ev.value;
};
const oncancel = () => {
showMonth = false;
};

</script>

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

Related article: Handling date selection