马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
<template>
<v-date-picker
style="font-size: 26px"
v-model="_value"
color="#FE880A"
@change="change"
no-title
:width="width"
:allowedDates="allowedDatesFunc"
class="reserve-calendar"
:header-date-format="headerDateFormat"
>
</v-date-picker>
</template>
可以log _value是什么值 然后 要包装到new Date 再返回
const options = { month: "short", year: "numeric" };
const headerDateFormat = (_value) => {
const date = new Date(_value);
return date.toLocaleDateString("en-US", options);
};
这里附上一些解释
参数:
toLocaleDateString()方法可以接受两个参数:locales和options。
- locales参数:一个字符串或字符串数组,表示要利用的语言环境。这个参数利用BCP 47语言标签。比方,英语(美国)的标签为"en-US",而中文(中国)的标签为"zh-CN"。
- options参数:一个对象,用于定制日期和时间的格式。这个对象可以包罗以下属性:
- era: 'narrow', 'short', 'long'
- year: 'numeric', '2-digit'
- month: 'numeric', '2-digit', 'narrow', 'short', 'long'
- day: 'numeric', '2-digit'
- weekday: 'narrow', 'short', 'long'
- hour: 'numeric', '2-digit'
- minute: 'numeric', '2-digit'
- second: 'numeric', '2-digit'
- timeZoneName: 'short', 'long'
<day-name> “星期一”,“星期二”,“星期三”,“星期四”,“星期五”,“星期六”或“太阳”之一(区分大小写)。 “04”或“23”
<month> “Jan”,“Feb”,“Mar”,“Apr”,“May”,“Jun”,“Jul”,“Aug”,“Sep”,“十进制“,”十一月“,”十二月“(区分大小写)。
<year> 4位数年份编号,比方“1990”或“2016”。
<hour> 2位数小时编号,比方“09”或“23”。
<minute> 2位数分钟数,比方“04”或“59”。
<second> 2位数秒数,比方“04”或“59” .GMT
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |