效果图
直接贴上这个功能,这个样式所有的代码,有需要可自行拿取,修改
<template>
<div class="life-record">
<!-- 头部搜索,及添加按钮 -->
<div class="header">
<div class="date-picker">
<el-button
icon="el-icon-arrow-left"
type="text"
@click="toPrev"
></el-button>
<el-date-picker
style="width: 136px"
v-model="currentTime"
type="date"
placeholder="选择日期"
class="date-choose"
>
</el-date-picker>
<el-button
icon="el-icon-arrow-right"
type="text"
@click="toNext"
></el-button>
</div>
<el-input
style="width: 300px"
placeholder="关键字搜索"
suffix-icon="el-icon-search"
v-model="params.keyword"
@keyup.enter.native="search"
class="search"
>
</el-input>
<el-button type="primary" class="add-btn" round @click="addRecord = true"
>添加记录</el-button
>
</div>
<!-- 日历组件 -->
<el-calendar v-model="currentTime">
<template slot="dateCell" slot-scope="{ date, data }">
<p>{
{
data.day.split("-").slice(2).join() }}</p>
<template v-for="(item, index) in lifeListMessage">
<el-popover
v-if="item.createData == data.day"
:key="index"
placement="top-start"
width="200"
trigger="hover"
:content="item.recordDetails"
>
<el-button
v-if="item.createData == data.day"
@click="toDetail(data.day)"
class="popover-btn"
slot="reference"
:class="
item.label == 3
? 'mood'
: item.label == 2
? 'every-style'
: 'run'
"
>{
{
item.description }}</el-button
>
</el-popover>
</template>
</template>
</el-calendar>
<!-- 弹窗 -->
<div class="darkBoxs" v-if="addRecord">
<div class="main">
<div class="top">
<span>添加生活记录</span>
<i class="el-icon-close right" @click="addRecord = false"></i>
</div>
<el-form :model="formList" :rules="rules" ref="formList"