相思资源网 Design By www.200059.com
辰小白小白最近在写日历模板,项目已经用了element组件,奈何element日历组件官方文档提供的资料实在太少了。所以这里希望有相关开发需要的朋友能够少走一些辰小白踩过的坑。
首先展示一些模板效果图:
这个项目的详细介绍可以下辰小白的这篇文章:后端开发的福音,vue+element实现的vue-element-admin前台框架,开箱即用
下面是日历模板首页源码
<template> <div> <el-card class="_calendar"> <el-container> <el-main> <el-card> <el-calendar v-model="value" :first-day-of-week="7"> <!-- 这里使用的是 2.5 slot 语法,对于新项目请使用 2.6 slot 语法--> <template slot="dateCell" slot-scope="{date, data}"> <div slot="reference" class="div-Calendar" @click="calendarOnClick(data)"> <p :class="data.isSelected "> {{ data.day.split('-').slice(1).join('-') }} <i :class="[data.isSelected " ></i> <i v-if="_.indexOf(isArrange, data.day)>0" class="el-icon-s-claim"></i> <!-- <i class="el-icon-coffee-cup"></i> --> </p> </div> </template> </el-calendar> </el-card> </el-main> <el-aside width="40%" style="overflow: hidden;"> <el-card> <div class="el-calendar__header"> <div class="el-calendar__title">排班详情</div> <div class="el-calendar__button-group"> <div class="el-button-group"> <button type="button" class="el-button el-button--plain el-button--mini" @click="saveOnClick" > <span>新增</span> </button> </div> </div> </div> <div class="calendar-info"> <div style="padding: 15px;"> <div role="alert" class="el-alert el-alert--success is-dark" @click="infoOnClick"> <i class="el-alert__icon el-icon-success is-big"></i> <div class="el-alert__content"> <span class="el-alert__title is-bold">2020-06-19 9:00~11:00</span> <p class="el-alert__description">值班人员:张三、李四、王五</p> <p class="el-alert__description">携带设备:123547、985431、745481</p> <i class="el-alert__closebtn el-icon-close" @click.stop="infoDel"></i> </div> </div> <div role="alert" class="el-alert el-alert--info is-dark" @click="infoOnClick"> <i class="el-alert__icon el-icon-info is-big"></i> <div class="el-alert__content"> <span class="el-alert__title is-bold">2020-06-19 9:00~11:00(待审核)</span> <p class="el-alert__description">值班人员:张三、李四、王五</p> <p class="el-alert__description">携带设备:123547、985431、745481</p> <i class="el-alert__closebtn el-icon-close"></i> </div> </div> <div role="alert" class="el-alert el-alert--warning is-dark" @click="infoOnClick"> <i class="el-alert__icon el-icon-warning is-big"></i> <div class="el-alert__content"> <span class="el-alert__title is-bold">警告提示的文案</span> <p class="el-alert__description">文字说明文字说明文字说明文字说明文字说明文字说明</p> <i class="el-alert__closebtn el-icon-close"></i> </div> </div> <div role="alert" class="el-alert el-alert--error is-dark" @click="infoOnClick"> <i class="el-alert__icon el-icon-error is-big"></i> <div class="el-alert__content"> <span class="el-alert__title is-bold">错误提示的文案</span> <p class="el-alert__description">文字说明文字说明文字说明文字说明文字说明文字说明</p> <i class="el-alert__closebtn el-icon-close"></i> </div> </div> </div> </div> </el-card> </el-aside> </el-container> </el-card> <calendarDrawer ref="calendarDrawer"></calendarDrawer> <calendarForm ref="calendarForm"></calendarForm> </div> </template> <script> import calendarDrawer from "./calendar-drawer.vue"; import calendarForm from "./calendar-form.vue"; export default { components: { calendarDrawer, calendarForm }, data: function() { return { value: new Date(), isArrange: [ "2020-06-08", "2020-06-09", "2020-06-10", "2020-06-11", "2020-06-17", "2020-06-18" ] }; }, created: function() { this.$nextTick(() => { // 点击前一个月 let prevBtn = document.querySelector( ".el-calendar__button-group .el-button-group>button:nth-child(1)" ); prevBtn.addEventListener("click", e => { console.log(this.data); this.$notify({ title: "上一月", message: "上个月头天:" + this.value, type: "success", position: "top-left" }); }); //点击下一个月 let nextBtn = document.querySelector( ".el-calendar__button-group .el-button-group>button:nth-child(3)" ); nextBtn.addEventListener("click", () => { console.log(this.value); this.$notify({ title: "下一月", message: "下个月头天:" + this.value, type: "warning", position: "top-left" }); }); //点击今天 let todayBtn = document.querySelector( ".el-calendar__button-group .el-button-group>button:nth-child(2)" ); todayBtn.addEventListener("click", () => { this.$notify.info({ title: "今天", message: "今天:" + this.value, position: "top-left" }); }); }); }, mounted: function() {}, methods: { //点击日期块 calendarOnClick(e) { console.log(e); // this.isArrange.push("2020-06-19"); this.$notify.error({ title: "日历块点击", message: e, position: "top-left" }); }, //点击信息块 infoOnClick() { this.$refs.calendarDrawer.drawer = true; }, //新增排班 saveOnClick() { this.$refs.calendarForm.dialogFormVisible = true; }, //删除排班 infoDel() { this.$confirm("此操作将永久删除该排班, 是否继续", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }) .then(() => { this.$message({ type: "success", message: "删除成功!" }); }) .catch(() => { this.$message({ type: "info", message: "已取消删除" }); }); } } }; </script> <style scoped> .is-selected { color: #1989fa; } .p-popover { text-align: center; } ._calendar { height: 99.5%; width: 100%; } .el-main { padding: 0px; overflow: hidden; } .calendar-info { height: 94%; overflow: auto; } .el-alert { margin: 15px 0px; } .el-alert:hover { transform: scale(1.02); } .el-alert:active { transform: scale(1.01); } </style> <style > ._calendar .div-Calendar { height: 125px; box-sizing: border-box; padding: 8px; } ._calendar .el-calendar-table .el-calendar-day { padding: 0px; height: 125px; } ._calendar .el-container, ._calendar .el-calendar { height: 100%; } ._calendar .el-card__body { padding: 0px; } </style>
具体的几个点击事件都有备注,这里不细说了
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无element日历calendar组件上月、今天、下月、日历块点击事件及模板源码的评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?