时间季度组件

16 篇文章 0 订阅
<template>
	<el-form label-width="100" style="width: 18.75rem;">
		<el-form-item label="季度">
			<mark class="_mark" v-show="showSeason" @click.stop="showSeason = false"></mark>
			<el-input size="mini" placeholder="请选择日期" v-model="time" @focus="showSeason = true">
				<i slot="prefix" class="el-input__icon el-icon-date"></i>
			</el-input>
			<el-card class="box-card" v-show="showSeason">
				<div slot="header" class="clearfix yearBtn">
					<button type="button" class="el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left" @click="prev"></button>
					<span role="button" class="el-date-picker__header-label">{{ year }}年</span>
					<button type="button" @click="next" class="el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right"></button>
				</div>
				<div class="div-quarter">
					<el-button v-for="(item, key) in quarterList" :key="key" type="text" size="medium" @click="selectSeason(key)">{{ item }}</el-button>
				</div>
			</el-card>
		</el-form-item>
	</el-form>
</template>
<script>
export default {
	data() {
		return {
			showSeason: false,
			season: '',
			year: new Date().getFullYear(),
			quarterList: ['第一季度', '第二季度', '第三季度', '第四季度']
		}
	},
	methods: {
		
		prev() {
			this.year = this.year * 1 - 1
		},
		
		next() {
			this.year = this.year * 1 + 1
		},
		
		selectSeason(i) {
			this.season = i + 1
			this.showSeason = false
			this.time = `${this.year}年${this.season}季度`
		}
	}
}
</script>
<style scoped lang="scss">
._mark {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0);
	z-index: 999;
}
.box-card {
	width: 322px;
	padding: 0 3px 20px;
	margin-top: 10px;
	position: fixed;
	z-index: 9999;
	& > ::v-deep .el-card__body {
		padding-top: 0;
		padding-bottom: 0;
	}
	.yearBtn {
		text-align: center;
		height: 30px;
		line-height: 1.875rem;
	}
	.div-quarter {
		button {
			border: 1px solid;
			width: 130px;
		}
		button:nth-child(3) {
			margin-left: 0px;
		}
	}
}
</style>

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值