<template>
	<view class="content">
		<uni-calendar class="uni-calendar--hook" :selected="info.selected" :showMonth="false" @change="change"
			@monthSwitch="monthSwitch" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {
					lunar: true,
					range: true,
					insert: false,
					selected: []
				}
			};
		},
		methods: {
			change(e) {
				console.log('change 返回:', e)
				// 选中日期
				const selectedValue = this.info.selected.find(item => item.date === e.fulldate)
				if (selectedValue) {
					// 存在则移除
					this.info.selected = this.info.selected.filter(item => item.date !== e.fulldate);
				} else {
					this.info.selected.push({
						date: e.fulldate,
						info: '选中'
					})
				}

				console.log(this.info.selected)
			},
		}
	};
</script>
