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

公司网站开发部署百度站长工具域名查询

公司网站开发部署,百度站长工具域名查询,永州建设企业网站,做网站 图片需要多大的最近在项目中要实现日期排班的功能,正好要用到日历视图的控件,经过对比发现,vue 中 使用 FullCalendar 可以实现相关需求,下面对使用过程做一个总结。 一. 引入 FullCalendar 控件 package.json 中添加相关依赖 "dependen…

最近在项目中要实现日期排班的功能,正好要用到日历视图的控件,经过对比发现,vue 中 使用 FullCalendar 可以实现相关需求,下面对使用过程做一个总结。

一. 引入 FullCalendar 控件

package.json 中添加相关依赖

"dependencies": {"@fullcalendar/bootstrap5": "^6.1.15","@fullcalendar/core": "^6.1.15","@fullcalendar/daygrid": "^6.1.15","@fullcalendar/interaction": "^6.1.15","@fullcalendar/list": "^6.1.15","@fullcalendar/timegrid": "^6.1.15","@fullcalendar/vue": "^6.1.15",}

二. 页面中引入 FullCalendar

<template><div class="common-list"><!-- 日历控件 --><div ><FullCalendar :options="calendarOptions" /></div></div>
</template>

相应的 javascript 方法说明

<script>
import FullCalendar from '@fullcalendar/vue'
import dayGridPlugin from '@fullcalendar/daygrid'
import interactionPlugin from '@fullcalendar/interaction'
import timeGridPlugin from '@fullcalendar/timegrid'
import listPlugin from '@fullcalendar/list'import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-icons/font/bootstrap-icons.css';
import bootstrap5Plugin from '@fullcalendar/bootstrap5';
import { formatDate} from '@/utils'
import {listDutyPlanCalendar,
} from "@/api/duty/zbrl";
export default {components: {FullCalendar // make the <FullCalendar> tag available},data() {return {// 搜索参数queryParams: {pageNum: 1,pageSize: 100,startDate: '',endDate: '',},// 日历配置calendarOptions: {plugins: [dayGridPlugin, interactionPlugin, bootstrap5Plugin, listPlugin, timeGridPlugin],locale: 'zh-cn',themeSystem: 'bootstrap5',headerToolbar: {end: 'today prev next dayGridMonth dayGridWeek',},// 周一从星期一开始,0为星期日// firstDay: 1,buttonText: {today: '今天',month: '月',week: '周'},// 在日历的初始化完成后执行的事件datesSet: this.handleDateChange,/*customButtons: {myCustomButton: {text: 'custom!',click: function() {alert('Clicked the custom button in v6!');}}},*/views: ['dayGridMonth', 'dayGridWeek', 'dayGridDay'],initialView: 'dayGridMonth',//日期点击事件dateClick: this.handleDateClick,events: [{ title: 'event 1', date: '2024-09-01'},{ title: 'event 2', date: '2024-09-01' },{ title: 'event 3', date: '2024-09-03' },],// 添加事件点击处理eventClick: function(info) {// 这里是点击事件时执行的代码// alert('你点击了事件: ' + info.event.title);// 你可以在这里执行更多逻辑,比如打开模态框显示事件详情},}}},created() {this.handleQuery();},methods: {//查询接口数据handleQuery() {listDutyPlanCalendar(this.queryParams).then(res => {if(res.code === 200){this.calendarOptions.events = res.rows;}console.log(res)console.log(this.calendarOptions.events)});},// 当日历的日期范围发生变化时,监听事件handleDateChange(info) {if(this.queryParams){console.log(this.queryParams.startDate)this.queryParams.startDate = formatDate(info.start).substring(0, 10);this.queryParams.endDate = formatDate(info.end).substring(0, 10);this.handleQuery();}// 当日历的日期范围发生变化时(包括翻页操作),这个函数会被调用// console.log('新的日期范围:', info.startStr, '到', info.endStr);},resetQuery() { },//某个日期点击监听方法handleDateClick(arg) {console.log(arg)alert('date click! ' + arg.dateStr)},}
}
</script>

三. 最终页面实现效果

在这里插入图片描述

四. 功能点实现总结

1. calendarOptions 详解

FullCalendar 的 calendarOptions 是一个非常重要的配置项,它包含了初始化 FullCalendar 日历所需的各种设置和参数。以下是对 calendarOptions 中一些常见属性的详细解析:

1. 插件列表(plugins)

作用:定义 FullCalendar 需要加载的插件。FullCalendar 的许多功能都是通过插件来实现的。
示例:

plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin]

这里加载了日视图(dayGridPlugin)、时间网格视图(timeGridPlugin)和交互插件(interactionPlugin),后者允许用户拖拽、缩放等交互操作。

2. 默认视图(initialView)

作用:设置日历初始化时显示的视图。
示例:

initialView: 'dayGridMonth'

这将日历的初始视图设置为月视图,并以日网格(dayGrid)的形式展示。

3. 语言(locale)

作用:设置日历的语言。FullCalendar 支持多种语言,通过设置 locale 属性可以实现界面的国际化。
示例:

locale: 'zh-cn'

这将日历的语言设置为中文。

4. 头部工具栏(headerToolbar)

作用:自定义日历头部的工具栏布局和按钮。
示例:

headerToolbar: {  left: 'today prev,next',  center: 'title',  right: 'dayGridMonth,timeGridWeek,timeGridDay'  
}

这将在日历头部左侧放置“今天”、“上一个”、“下一个”按钮,中间显示标题,右侧放置月视图、周视图和日视图的切换按钮。

5. 按钮文本(buttonText)

作用:自定义头部工具栏中各按钮的显示文本。
示例:

buttonText: {  today: '今天',  month: '月',  week: '周',  day: '日',  prev: '‹',  next: '›'  
}

这将把头部工具栏中的按钮文本替换为中文或自定义符号。

6. 周起始日(firstDay)

作用:设置一周中哪一天作为起始日。FullCalendar 默认周日为一周的开始,但可以通过此属性进行自定义。
示例:

firstDay: 1

这将把周一设置为一周的开始(注意:FullCalendar 中周日是 0,周一是 1,以此类推)。

7. 事件(events)

作用:定义日历中要展示的事件数组。每个事件对象可以包含日期、标题、描述等信息。
示例:

events: [  { title: '事件1', date: '2024-09-28' },  { title: '事件2', start: '2024-09-29T10:00:00', end: '2024-09-29T12:00:00' }  
]
8. 其他常用属性

aspectRatio:设置日历单元格的宽高比。
eventColor:设置所有日历事件的背景颜色。
editable:是否允许用户通过拖拽、缩放等方式修改事件。
selectable:是否允许用户选择日历上的日期范围。
eventClick:点击事件时触发的回调函数。
dateClick:点击日期时触发的回调函数。

2. 日历中添加 日期点击事件

//日期点击事件dateClick: this.handleDateClick,
http://www.hkea.cn/news/378018/

相关文章:

  • 网站建设标志设计北京网站优化公司
  • 图标使用wordpress杭州seo博客
  • 企业网站如何做推广竞价推广托管公司介绍
  • 网站如何做微信登录seo公司 杭州
  • 中山里水网站建设软文广告案例分析
  • 做外贸是用什么网站做新型网络营销方式
  • 心理咨询网站开发百度手机seo软件
  • 17网站一起做网批seo营销优化
  • 做赚钱网站程序员培训班要多少钱
  • 已经收录大规模修改收录页面对网站有影响吗什么软件可以推广自己的产品
  • 丁香园做科室网站厦门网络推广
  • 免费的企业网站制作提高网站权重的方法
  • 兰州网站制作怎么样网页在线生成
  • 自建网站网址雅虎搜索引擎首页
  • 注册科技有限公司可以做网站吗百度搜索排名机制
  • 武汉做网站好网站制作多少钱一个
  • 安阳网站建设怎么从网上找客户
  • 文章博客媒体网站模板怎样在百度上打广告
  • 做网站是不是要模板直接打开百度
  • 哪个网站做app推广服务商
  • 中国哪里在大建设网站优化培训学校
  • 自己做的网站点首页出错腾讯广告代理商加盟
  • 如何做免费的网站推广东莞百度seo
  • 宜昌网站制作公司百度竞价官网
  • 建站公司网站模板论坛怎么建网站
  • 上海做b2b网站公司深圳公司网络推广该怎么做
  • 自己做的网站怎么在百度可以查到网络小说网站三巨头
  • 怎么做网站客服弹窗站长之家seo工具包
  • 自己建一个电商网站吗网络营销的定义
  • 专门做金融的招聘网站四川seo选哪家