当前位置: 首页 > wzjs >正文

ps做网站宽度seo和竞价排名的区别

ps做网站宽度,seo和竞价排名的区别,家纺 网站模版,北京小企业网站建设生成指定日期范围内的所有日期 generateDateRange(startStr, endStr) {const dates []; 日期列表const start new Date(startStr); 日程开始日期const end new Date(endStr); 日程结束日期end.setHours(23, 59, 59, 999); 结束的那一天设置为23点59分59秒// 生成日期范围内…

 生成指定日期范围内的所有日期

generateDateRange(startStr, endStr) {const dates = [];  日期列表const start = new Date(startStr); 日程开始日期const end = new Date(endStr); 日程结束日期end.setHours(23, 59, 59, 999); 结束的那一天设置为23点59分59秒// 生成日期范围内的所有日期let currentDate = new Date(start);  判断天数设置为日程开始日期while (currentDate <= end) {const dateStr = this.formatDate(currentDate); dates.push(dateStr); 如果当前判断的日期在日程范围内就加入日期列表currentDate.setDate(currentDate.getDate() + 1); 日期判断天数加1}return dates;},// 格式化日期为 'YYYY-MM-DD' 字符串formatDate(date) {const year = date.getFullYear();const month = String(date.getMonth() + 1).padStart(2, '0');const day = String(date.getDate()).padStart(2, '0');return `${year}-${month}-${day}`;},

 // 生成所有日期范围内的日期

// 生成所有日期范围内的日期generateDateRanges() {const allDates = [];this.backendDateRanges.forEach(range => {const startStr = this.convertDateformat(range.start);const endStr = this.convertDateformat(range.end);const dates = this.generateDateRange(startStr, endStr);allDates.push(...dates);});// 去重this.selectedDates = [...new Set(allDates)];},

    // 判断当前日期是否在选定日期范围内 

isSelectedDate(day) {return this.selectedDates.includes(day);},

    // 显示某天的日程列表

showEvents(day) {this.currentDay = day;this.currentDayEvents = this.backendDateRanges.filter(range => {const startStr = this.convertDateformat(range.start);const endStr = this.convertDateformat(range.end);const start = new Date(startStr);const end = new Date(endStr);const current = new Date(day);// 设置结束日期为当天的最后时刻,以确保包含结束日期end.setHours(23, 59, 59, 999);return current >= start && current <= end;});}

完整代码

<template><div><el-calendar v-model="value" style="width: 30%;height: 50%;" ><!-- 自定义日期单元格插槽 --><template slot="dateCell" slot-scope="{ data }"><div @click="showEvents(data.day)"><!-- 显示日期 --><div class="date-content">{{ data.day.split('-').slice(2).join('-') }}</div><!-- 如果日期在 selectedDates 中,显示红点 --><div v-if="isSelectedDate(data.day)" class="dot"></div></div></template></el-calendar><!-- 显示日程列表 --><div v-if="currentDayEvents.length > 0" class="events-list" style="width: 30%;height: 50%;" ><h3>日程列表 ({{ currentDay }})</h3><ul><li v-for="event in currentDayEvents" :key="event.id">{{ event.title }}</li></ul></div></div>
</template><script>export default {data() {return {value: new Date(),backendDateRanges: [{id: 1,title: '日程1',start: '2025/03/01',end: '2025/04/06'},{id: 2,title: '日程2',start: '2025/04/02',end: '2025/04/10'}],// 动态生成的选定日期数组selectedDates: [],// 当前点击日期的日程列表currentDayEvents: [],// 当前点击的日期currentDay: ''};},mounted() {// 在组件挂载后生成选定日期范围this.generateDateRanges();},methods: {myEcharts(){//var myChart = this.$echarts.init(document.getElementById('main'));},// 将后端传过来的日期格式转换为 YYYY-MM-DDconvertDateformat(dateStr) {return dateStr.split('/').join('-');},// 生成指定日期范围内的所有日期generateDateRange(startStr, endStr) {const dates = [];const start = new Date(startStr);const end = new Date(endStr);end.setHours(23, 59, 59, 999);// 生成日期范围内的所有日期let currentDate = new Date(start);while (currentDate <= end) {const dateStr = this.formatDate(currentDate);dates.push(dateStr);currentDate.setDate(currentDate.getDate() + 1);}return dates;},// 格式化日期为 'YYYY-MM-DD' 字符串formatDate(date) {const year = date.getFullYear();const month = String(date.getMonth() + 1).padStart(2, '0');const day = String(date.getDate()).padStart(2, '0');return `${year}-${month}-${day}`;},// 生成所有日期范围内的日期generateDateRanges() {const allDates = [];this.backendDateRanges.forEach(range => {const startStr = this.convertDateformat(range.start);const endStr = this.convertDateformat(range.end);const dates = this.generateDateRange(startStr, endStr);allDates.push(...dates);});// 去重this.selectedDates = [...new Set(allDates)];},// 判断当前日期是否在选定日期范围内isSelectedDate(day) {return this.selectedDates.includes(day);},// 显示某天的日程列表showEvents(day) {this.currentDay = day;this.currentDayEvents = this.backendDateRanges.filter(range => {const startStr = this.convertDateformat(range.start);const endStr = this.convertDateformat(range.end);const start = new Date(startStr);const end = new Date(endStr);const current = new Date(day);// 设置结束日期为当天的最后时刻,以确保包含结束日期end.setHours(23, 59, 59, 999);return current >= start && current <= end;});}}
};
</script><style scoped>
.date-content {margin-bottom: 5px;}.dot {width: 6px;height: 6px;background-color: red;border-radius: 50%;display: inline-block;
}.events-list {margin-top: 20px;padding: 10px;background-color: #f5f5f5;border-radius: 5px;
}.events-list h3 {margin-top: 0;
}.events-list ul {list-style-type: none;padding: 0;
}.events-list li {padding: 5px 0;
}
</style>

http://www.dtcms.com/wzjs/299748.html

相关文章:

  • 手机网站制作合同镇江网站建设方案
  • 想学做网站学什么教程广州seo成功案例
  • 医院网站建设联系方式b2b平台有哪几个
  • 怎么在百度做公司网站百度手机seo
  • 门户网站是什么百度集团
  • webview做网站app百度网盘网页版登录首页
  • 西安搜建站科技网站百度知道免费提问
  • 哪家做网站公司好软文网站发布平台
  • wordpress修改时区seo排名工具外包
  • 网站建设论文参考文献google海外推广
  • 广州网站建设公司兴田德润怎么样浏览器打开
  • 武汉新天厦建设工程有限公司网站浙江seo博客
  • 有源码怎么做网站网站seo需要用到哪些工具
  • 盐城市建设银行网站b站24小时自助下单平台网站
  • 那个网站可以做网页网络营销策划方案ppt模板
  • 广东省住房城乡建设厅网站如何免费做视频二维码永久
  • b2b2c 网站架构图友情链接交换系统
  • 网站你懂我意思正能量免费软件app推广是什么意思
  • 昆山网站建设犀牛大叔企业网络推广平台
  • 做网站找哪家好 07月百度招聘电话
  • 天津塘沽网站建设软文网
  • 上海企业建站公司排名seo怎么快速提高排名
  • 个人网站首页设计优秀作品百度下载安装 官方
  • 桂平市住房和城乡建设局网站百度网盘搜索引擎入口在哪
  • 大型服装商城网站建设刺激广告
  • 广州网站优化地址在线seo诊断
  • 扁平化风格 网站地推任务网
  • 网站开发小图片域名注册哪个平台比较好
  • 企业名录模板关键词排名快照优化
  • 怎么做网站投放adsense张雪峰谈广告学专业