赞
踩
参考: https://www.jianshu.com/p/1aa165255697
https://momentjs.com/
https://www.antdv.com/components/date-picker-cn/
<template> <div> <a-date-picker :default-value="moment('2015/01/01', dateFormat)" :format="dateFormat" /> <br /> <a-date-picker :default-value="moment('01/01/2015', dateFormatList[0])" :format="dateFormatList" /> <br /> <a-month-picker :default-value="moment('2015/01', monthFormat)" :format="monthFormat" /> <br /> <a-range-picker :default-value="[moment('2015/01/01', dateFormat), moment('2015/01/01', dateFormat)]" :format="dateFormat" /> </div> </template> <script> import moment from 'moment'; export default { data() { return { dateFormat: 'YYYY/MM/DD', monthFormat: 'YYYY/MM', dateFormatList: ['DD/MM/YYYY', 'DD/MM/YY'], }; }, methods: { moment, }, }; </script>
npm install moment --save # npm
yarn add moment # Yarn
Install-Package Moment.js # NuGet
spm install moment --save # spm
meteor add momentjs:moment # meteor
bower install moment --save # bower (deprecated)
(中国地区时间)
var now = moment().locale('zh-cn').format('YYYY-MM-DD HH:mm:ss');
moment().locale('zh-cn').subtract(3, 'days').format('YYYY-MM-DD'), dateFormat) #前三天的时间
moment().locale('zh-cn').add(3, 'days').format('YYYY-MM-DD'), dateFormat) # 后三天的时间
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。