Element UI 中 data 日期
Element UI 中 data 日期
赋值
<template> <div> <div> <el-date-picker v-model="value1" type="date" placeholder="选择日期">el-date-picker> <el-button type="primary" @click="setDate1">时间赋值1el-button> div> <div> <el-form ref="form" :model="form" label-width="80px"> <el-form-item label="日期" prop="planTime"> <el-date-picker v-model="form.planTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"> el-date-picker> el-form-item> <el-button type="primary" @click="setDate2">时间赋值2el-button> el-form> div> div> template> <script> /* 这是ElementUI */ import Vue from 'vue' import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; Vue.use(ElementUI); /* 这是ElementUI */ export default { components:{}, data() { return { value1:null, form: {} } }, methods: { setDate1() { this.value1 = '2010-01-01' }, setDate2() { this.$set(this.form, 'planTime', ['2010-01-01','2010-01-03']); } }, }; script>