最近使用vue3+typeScript+elementPlus技术栈构建了一个周报系统
在使用日期选择器的周选择器的时候,发现每周开始日期从周六开始
但项目要求周一开始,于是乎开始一天的搜索...
vue2 elementUi 使用:picker-options="{firstDayOfWeek:1}" ,elementPlus废弃了该属性
在elementPlus的github issues中找到了解决办法
安装 dayjs
npm install dayjs --save
在 mian.js 中引入dayjs使用中文环境
import { createApp } from "vue";
import ElementPlus from "element-plus";
import locale from "element-plus/lib/locale/lang/zh-cn";
import dayjs from "dayjs";
import "dayjs/locale/zh-cn";
import "element-plus/lib/theme-chalk/index.css";
import App from "./App.vue";
dayjs.locale("zh-cn");
createApp(App).use(ElementPlus, { locale }).mount("#app");