<template>
	<div>
		<van-nav-bar title="新增大事" left-text="返回" left-arrow @click-left="onClickLeft" />
		<van-form @failed="onFailed" @submit="onSubmit">
			<van-cell-group inset>				
				<van-field v-model="birsday" is-link readonly name="datePicker" label="时间" placeholder="请输入时间"
					@click="showPicker = true" />
				<van-popup v-model:show="showPicker" position="bottom">
					<van-date-picker :min-date="minDate" @confirm="onConfirm" @cancel="showPicker = false" />
				</van-popup>
				<van-field type="textarea"  v-model="nickname" label="事件" placeholder="请输入事件" ></van-field>
			</van-cell-group>
			<div style="margin: 16px;">
				<van-button round block type="primary" native-type="submit">
					记入宗册
				</van-button>
			</div>
		</van-form>
	</div>
</template>

<script setup>
	import {
		ref
	} from "vue";

	const onClickLeft = () => history.back();

	const minDate = ref(new Date(1970, 0, 1));
	const birsday = ref('');
	const showPicker = ref(false);
	const onConfirm = ({
		selectedValues
	}) => {
		birsday.value = selectedValues.join('/');
		showPicker.value = false;
	};

	const baseFormData = ref({});
	const sexs = ref([{
			value: 1,
			text: "男"
		},
		{
			value: 2,
			text: "女"
		}
	]);
	const life = ref([{
			value: 1,
			text: "生"
		},
		{
			value: 2,
			text: "卒"
		}
	]);
	const hobbys = ref([{
			value: 1,
			text: "男"
		},
		{
			value: 2,
			text: "女"
		}
	]);


	function formSubmit() {

	}
</script>

<style lang="scss">
	.textbomcenter {
		text-align: center;
		// top: 20rpx;
		left: 0;
		right: 0;
		position: static;
		bottom: 15rpx;
		text-decoration: underline;
		font-weight: 400;
		color: cornflowerblue;
	}

	.goods-box {
		display: flex;
		flex-wrap: wrap;

		// 图片列表
		.imgList {
			position: relative;
			width: 180rpx;
			height: 180rpx;
			margin: 0 50rpx 30rpx 0;
		}

		// 删除图片
		.del {
			position: absolute;
			width: 60rpx;
			height: 60rpx;
			right: 0rpx;
			z-index: 999;
		}
	}
</style>