问题描述:el-date-picker
原本用的是monthrange
月区间选项,后来想改成年区间,el官网没有这个组件,下面是结合百度搜索+实际情况,已经过测试给出的结果!
1、引入组件
<el-date-picker
v-model="value"
type="yearrange"
align="right"
unlink-panels
range-separator="至"
:format="yyyy"
:value-format="yyyy"
:start-placeholder="beginDate"
:end-placeholder="endDate"
></el-date-picker>
//type="yearrange"这是重点
2、下载2文件替换js文件
点击下载
找到node_moduleselement-uilibdate-picker.js替换掉
找到node_moduleselement-uilibelement-ui.common.js替换掉
3、在element-ui/index.css新增以下样式
.el-year-table td {
padding: 8px 0;
}
.el-year-table td div {
height: 48px;
padding: 6px 0;
box-sizing: border-box;
}
.el-year-table td div .cell {
height: 36px;
line-height: 36px;
border-radius: 18px;
}
.el-year-table td.start-date div {
border-top-left-radius: 24px;
border-bottom-left-radius: 24px;
}
.el-year-table td.end-date div {
border-top-right-radius: 24px;
border-bottom-right-radius: 24px;
}
.el-year-table td.in-range div {
background-color: #f2f6fc;
}
.el-year-table td.start-date .cell,
.el-year-table td.end-date .cell {
color: #fff;
background-color: #409eff;
}
.el-year-table td.today.start-date .cell,
.el-year-table td.today.end-date .cell {
color: #fff;
}
以上是编程学习网小编为您介绍的“修改element-ui源码兼容el-date-picker支持年区间选择”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。
沃梦达教程
本文标题为:修改element-ui源码兼容el-date-picker支持年区间选择


猜你喜欢
- firebug的一个有趣现象介绍 2023-12-01
- css列表标签list与表格标签table详解 2022-11-13
- reactjs-nginx尝试根据uri在目录中查找index.html 2023-10-25
- 纯css3实现鼠标经过图片显示描述的动画效果 2024-01-04
- JavaScript中如何使用cookie实现记住密码功能及cookie相关函数介绍 2024-02-13
- vue模拟娃娃机抽奖活动代码 2025-01-12
- 在阿里云服务器上部署Spring Boot + Vue项目 2023-10-08
- AJAX跨域问题解决方案详解 2023-02-24
- JavaScript股票的动态买卖规划实例分析上篇 2022-10-21
- 深入理解JavaScript系列(44):设计模式之桥接模式详解 2023-12-23