年之年的选择,组装版

news/2025/4/1 3:31:34/

在这里插入图片描述

组件:
<!--* @Author: liuyu liuyu@xizhengtech.com* @Date: 2023-02-01 16:57:27* @LastEditors: wangping wangping@xizhengtech.com* @LastEditTime: 2023-06-30 17:25:14* @Description: 时间选择年 --->
<template><div class="year-range-picker"><el-date-picker v-model="dateList[0]" :clearable="false" type="year" placeholder="开始年" class="year-picker" format="yyyy" value-format="yyyy" :picker-options="startDatePicker" @change="getTime"></el-date-picker><span class="range-word"></span><el-date-picker v-model="dateList[1]" prefix-icon='0' type="year" placeholder="结束年" class="year-picker" value-format="yyyy" :picker-options="endDatePicker" @change="getTime"></el-date-picker></div>
</template><script>
export default {data() {return {dateList: [],startDatePicker: this.beginDate(),endDatePicker: this.processDate(),// 开始年度和结束年度 添加限制// startDatePicker: {//   disabledDate: (time) => {//     if (this.startDatePicker) {//       return (//         time.getTime() > this.startDatePicker ||//         time.getTime() > Date.now()//       );//     }//   },// },// endDatePicker: {//   disabledDate: (time) => {//     return (//       time.getTime() < this.endDatePicker ||//       time.getTime() > Date.now()//     );//   },// },};},created() {},watch: {// dateList(v) {//   this.$emit("input", v);// },},methods: {getTime(val) {console.log("但:", this.dateList);if (val == null) {this.dateList = [];}this.$emit("getTime", this.dateList);},// 选择年份范围选择时开始时间不能大于结束时间,结束时间不能小于开始时间// 提出开始时间必须小于提出结束时间beginDate() {let self = this;return {disabledDate(time) {if (self.dateList[1] !== "" && self.dateList[1] !== null) {let fixedTime = new Date(time);return fixedTime.getFullYear() > self.dateList[1];} else {return;}},};},// 提出结束时间必须大于提出开始时间processDate() {let self = this;return {disabledDate(time) {// let fixedTime = new Date(self.oldTime).getTime()// return time.getTime() < fixedTimelet fixedTime = new Date(time);return fixedTime.getFullYear() < self.dateList[0];},};},},
};
</script>
<style lang="scss" scoped>
.year-range-picker {width: 260px;border: 1px solid #dcdfe6;border-radius: 4px;display: flex;align-items: center;::v-deep.el-date-editor {// .el-input__icon {//   display: none;// }.el-input__inner {border: none;text-align: center;}}
}
</style>
使用:
<YearYear @getTime="getTime"></YearYear>// 获取传过来的时间
getTime(val) {},

http://www.ppmy.cn/news/1020595.html

相关文章

列队 Queue 接口概述

在Java中&#xff0c;Queue&#xff08;队列&#xff09;是一种基本的数据结构&#xff0c;用于按照先进先出&#xff08;FIFO&#xff09;的顺序存储元素。Java提供了多种实现Queue接口的类&#xff0c;以下是几种常见的实现方式&#xff1a; LinkedList&#xff1a;LinkedLis…

【算法训练营】队列 合集(1)

&#x1f4cd;前言 本篇将学习queue的OJ题并学习queue的基础知识。 &#x1f57a;作者&#xff1a; 主页 我的专栏C语言从0到1探秘C数据结构从0到1探秘Linux菜鸟刷题集 &#x1f618;欢迎关注&#xff1a;&#x1f44d;点赞&#x1f64c;收藏✍️留言 &#x1f3c7;码字不易&a…

有答案:10个网络工程师面试常见问题

目录 1、交换机转发数据包的原理&#xff1f; 2. 数据包如果经过二层交换机转发后&#xff0c;那这个数据包的源MAC会变化吗&#xff1f;如果经过三层交换机理由转发&#xff0c;那源MAC会变成什么呢&#xff1f; 3. 如何查看PC的ARP表&#xff0c;如何清除ARP表&#xff0c…

机器人CPP编程基础-01第一个程序Hello World

很多课程先讲C/C或者一些其他编程课&#xff0c;称之为基础课程。然后到本科高年级进行机器人专业课学习&#xff0c;这样时间损失非常大&#xff0c;效率非常低。 C/单片机/嵌入式/ROS等这些编程基础可以合并到一门课中进行实现&#xff0c;这些素材已经迭代三轮以上&#xf…

代码随想录—力扣算法题:59螺旋矩阵II.Java版(示例代码与导图详解)

版本说明 当前版本号[20230810]。 版本修改说明20230810初版 目录 文章目录 版本说明目录59.螺旋矩阵II思路左闭右开方法左闭右闭方法两种方法的区别总结 59.螺旋矩阵II 力扣题目链接 更多内容可点击此处跳转到代码随想录&#xff0c;看原版文件 给定一个正整数 n&#xf…

Redis基础命令大全

这里写目录标题 第一章、Redis 命令大全1.1&#xff09;通用命令语法&#xff1a;ping语法&#xff1a;dbsize语法&#xff1a;select db语法&#xff1a;flushdb语法&#xff1a;exit 或 quit语法&#xff1a;redis-cli 1.2&#xff09;Redis 的 Key 的操作命令语法&#xff1…

培训报名小程序-订阅消息发送

目录 1 创建API2 获取模板参数3 编写自定义代码4 添加订单编号5 发送消息6 发布预览 我们上一篇讲解了小程序如何获取用户订阅消息授权&#xff0c;用户允许我们发送模板消息后&#xff0c;按照模板的参数要求&#xff0c;我们需要传入我们想要发送消息的内容给模板&#xff0c…

远程桌面配置指南:保留TCP地址、配置隧道和使用固定TCP地址

远程桌面配置指南&#xff1a;保留TCP地址、配置隧道和使用固定TCP地址 文章目录 远程桌面配置指南&#xff1a;保留TCP地址、配置隧道和使用固定TCP地址第一步&#xff1a;保留TCP地址第二步&#xff1a;为远程桌面隧道配置固定的TCP地址第三步&#xff1a;使用固定TCP地址远程…