![]() |
成熟的伏特加 · 美国队出局!法国队闯进篮球世界杯4强_手机新浪网· 1 月前 · |
![]() |
忐忑的围巾 · 美国再发“中国军力报告”,金一南:不合逻辑, ...· 5 月前 · |
![]() |
礼貌的消防车 · 【SERES赛力斯赛力斯SF5相关文章】赛力 ...· 1 年前 · |
![]() |
活泼的枕头 · 中国主题公园的困境与出路!_腾讯新闻· 1 年前 · |
![]() |
会搭讪的茄子 · 比特斯拉还要猛,687马力的奔驰AMG ...· 1 年前 · |
用于选择或输入日期
以「日」为基本单位,基础的日期选择控件
基本单位由
type
属性指定。快捷选项需配置
picker-options
对象中的
shortcuts
,禁用日期通过
disabledDate
设置,传入函数
<template>
<div class="block">
<span class="demonstration">默认</span>
<el-date-picker
v-model="value1"
type="date"
placeholder="选择日期">
</el-date-picker>
<div class="block">
<span class="demonstration">带快捷选项</span>
<el-date-picker
v-model="value2"
align="right"
type="date"
placeholder="选择日期"
:picker-options="pickerOptions1">
</el-date-picker>
</template>
<script>
export default {
data() {
return {
pickerOptions1: {
disabledDate(time) {
return time.getTime() > Date.now();
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
value1: '',
value2: '',
</script>
通过扩展基础的日期选择,可以选择周、月、年或多个日期