首页 前端知识 vue elementPlus中使用dayjs

vue elementPlus中使用dayjs

2025-03-13 15:03:16 前端知识 前端哥 973 340 我要收藏

安装了elementPlus后无需再次下载dayjs,因为element 中包含了dayjs

官网截图

引入方法:

import { dayjs } from 'element-plus'
// 引入中文包
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn') // 设置中文
复制

使用方法和dayjs 官网一致 

const state = reactive({
weekDate: dayjs().format('dddd'),
yearDate: dayjs().format('YYYY.MM.DD'),
hourDate: dayjs().format('HH:mm:ss')
})
复制

转载请注明出处或者链接地址:https://www.qianduange.cn//article/23534.html
标签
评论
会员中心 联系我 留言建议 回顶部
浏览器升级提示:您的浏览器版本较低,建议您立即升级为知了极速浏览器,极速、安全、简约,上网速度更快!立即下载
复制成功!