Commit 95d2e9ed by 胡悦

选择年份

1 parent 5da647b6
...@@ -109,19 +109,6 @@ img { ...@@ -109,19 +109,6 @@ img {
margin-top: 4px; margin-top: 4px;
} }
.title-icon {
display: flex;
align-items: center;
.icon {
display: inline-block;
width: 18px;
height: 10px;
margin-right: 4px;
background-image: url(../images/icon.png);
}
}
.container { .container {
height: 8.54vh; height: 8.54vh;
margin: 8px 6px 8px 8px; margin: 8px 6px 8px 8px;
......
<template> <template>
<div class="view-date">统计年份:业务开始时间:2022年6月30日</div> <div class="view-date">统计年份:
<div class="year-plugin">
<div class="year" @click="switchYear">
{{year}}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt="">
</div>
<div v-show="isShow" class="select-year">
<div class="year-item" :class="year == item ? 'active' : ''" v-for="(item,index) in dateList" :key="index" @click.s="selectYear(item)">{{item}}</div>
</div>
</div>
业务开始时间:2022年6月30日</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
export default { export default {
name: 'ViewDate' name: 'ViewDate',
data() {
return {
isShow: false,
dateList: ['2023', '2022', '2021', '2020'],
year: '2023'
}
},
methods: {
switchYear() {
this.isShow = !this.isShow
},
selectYear(item) {
console.log(item)
this.year = item
this.switchYear()
}
}
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
...@@ -13,8 +40,52 @@ export default { ...@@ -13,8 +40,52 @@ export default {
// width: 100%; // width: 100%;
height: 6.67vh; height: 6.67vh;
color: #C9C9C9; color: #C9C9C9;
font-size: 14px;
padding: 0 1.33vh; padding: 0 1.33vh;
background-color: #091C40; background-color: #091C40;
margin-top: 1.78vh; .year-plugin {
position: relative;
}
.select-year {
position: absolute;
top: 4.8vh;
width: 8.61vw;
background-color: #051526;
padding: 16px 20px;
box-sizing: border-box;
border: 2px solid;
border-image: linear-gradient(90deg, #074989, #30DCFF, #074989) 1;
.year-item {
margin-bottom: 8px;
color: #C9C9C9;
cursor: pointer;
&:hover {
color: #FFFFFF;
}
&:last-child {
margin-bottom: 0;
}
&.active {
color: #FFFFFF;
}
}
}
.year {
display: flex;
align-items: center;
justify-content: space-between;
width: 8.61vw;
height: 4vh;
padding: 0 0.56vw;
box-sizing: border-box;
background-image: linear-gradient(270deg, #6578FF 0%, #079FF1 100%);
margin-right: 0.56vw;
color: #FFFFFF;
.arrow-down {
width: 0.69vw;
height: 0.67vh;
}
}
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!