网站建设医药,互联网产品推广案例范文,网站规划设计书,百度排名服务(js)封装年月日获取方法#xff0c;页面根据type判断显示当前年#xff0c;年月#xff0c;日期 项目src——utils——index.js
// 获取当前年#xff0c;年月#xff0c;日期#xff0c;type,
export function getYearMonth(type) {var date new Date()var ye…(js)封装年月日获取方法页面根据type判断显示当前年年月日期 项目src——utils——index.js
// 获取当前年年月日期type,
export function getYearMonth(type) {var date new Date()var year date.getFullYear()var month date.getMonth() 1var day date.getDate()month (month 9) ? month : (0 month)day (day 10) ? (0 day) : dayvar today year - month - dayif(type year) {return year}else if(type month) {return year - month}else {return today}}页面使用
el-form-item classtime-box labelel-date-pickerv-modelquery.datetypemonthvalue-formatyyyy-MMplaceholder请选择clearableclasstime-select1changeselectChange($event, date)/
/el-form-itemscript
import { getYearMonth } from /utils;data() {return {query: { date: getYearMonth(month),},}
}/script