Element UI (Vue 2):
<template> <el-form-item prop="register_date" label="成立日期"> <el-date-picker v-model="temp.register_date" type="date" value-format="yyyy-MM-dd" default-value="2020-01-01" placeholder="选择日期" /> </el-form-item> </template> <script> export default { data() { return { temp: { register_date: '' } }; } }; </script>
Element Plus (Vue 3):
<template> <el-form-item prop="register_date" label="成立日期"> <el-date-picker v-model="temp.register_date" type="date" value-format="YYYY-MM-DD" :default-value="defaultDate" placeholder="选择日期" /> </el-form-item> </template> <script> import { defineComponent } from 'vue'; import { ElFormItem, ElDatePicker } from 'element-plus'; export default defineComponent({ components: { ElFormItem, ElDatePicker, }, data() { return { temp: { register_date: '' }, defaultDate: new Date().toISOString().split('T')[0] }; } }); </script>
标签:picker,Vue,Element,Plus,date,UI From: https://www.cnblogs.com/beichengshiqiao/p/18306959