You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
cesuan/components/dateselect2.vue

232 lines
4.5 KiB

<template>
<view class="uni-list-cell">
<view class="uni-list-cell-db text-wrapper_1">
<picker class="picker datepick" mode="date" :start="startDate" :end="endDate" @change="bindDateChange">
<view lines="1" class="text_46">{{year}}</view>
<view lines="1" class="text_3"></view>
<view lines="1" class="text_47">{{month}}</view>
<view lines="1" class="text_4"></view>
<view lines="1" class="text_48">{{day}}</view>
<view lines="1" class="text_5"></view>
</picker>
</view>
</view>
</template>
<script>
export default {
name:"dateselect2",
props: {
currentdate:{
type: String,
default: ''
}
},
created() {
if(this.currentdate!='')
{
var datearr = this.currentdate.split('-');
this.year = datearr[0];
this.month = datearr[1];
this.day= datearr[2];
}
},
data() {
var myDate = new Date();
return {
year:myDate.getFullYear(),
month:myDate.getMonth()+1,
day:myDate.getDate(),
time:myDate.getHours(),
startDate:'1900-01-01',
endDate:'2060-01-01',
time24:["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"],
date:''
};
},
methods:{
bindDateChange: function(e) {
console.log(e.target.value);
var datearr = e.target.value.split('-');
this.year = datearr[0];
this.month = datearr[1];
this.day= datearr[2];
this.$emit('dateselect',e.target.value) //把方法和值传递到页面
},
bindTimeEnd(e)
{
this.time = e.target.value;
this.$emit('timeselect',this.time) //把方法和值传递到页面
},
}
}
</script>
<style>
.uni-list-cell {
overflow-wrap: break-word;
color: rgba(34,24,21,1);
font-size: 30rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: left;
white-space: nowrap;
line-height: 30rpx;
margin: 61rpx auto 0 auto;
}
.uni-input
{
margin-top: 47rpx;
}
.tit,.uni-input
{
display: flex;
justify-content: space-between;
text-align: center;
}
.year_f
{
width: 100rpx;
}
.month_f
{
width: 100rpx;
}
.day_f
{
width: 100rpx;
}
.text-wrapper_1 {
background: url(../static/yy/zeri-1.png) 100% no-repeat;
background-size: 100% 100%;
width: 536rpx;
height: 50rpx;
flex-direction: row;
display: flex;
margin: 40rpx auto 26rpx auto;
position: relative;
}
.text_3 {
width: 60rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(128,127,128,1);
font-size: 24rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: center;
white-space: nowrap;
line-height: 50rpx;
}
.text_4 {
width: 60rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(128,127,128,1);
font-size: 24rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: center;
white-space: nowrap;
line-height: 50rpx;
margin: 0;
}
.text_5 {
width: 38rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(128,127,128,1);
font-size: 24rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: center;
white-space: nowrap;
line-height: 50rpx;
margin:0;
}
.text_16 {
position: absolute;
top:0;
width: 21rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(128,127,128,1);
font-size: 24rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: left;
white-space: nowrap;
line-height: 50rpx;
right: -30rpx;
}
.text_46 {
width: 128rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(34,24,21,1);
font-size: 30rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: center;
white-space: nowrap;
line-height: 50rpx;
margin-right: 30rpx;
}
.text_47 {
width: 84rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(34,24,21,1);
font-size: 30rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: center;
white-space: nowrap;
line-height: 50rpx;
margin-right: 34rpx;
}
.text_48 {
width: 106rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(34,24,21,1);
font-size: 30rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: center;
white-space: nowrap;
line-height: 50rpx;
margin-right: 36rpx;
}
.text_49 {
width: 78rpx;
height: 50rpx;
overflow-wrap: break-word;
color: rgba(34,24,21,1);
font-size: 30rpx;
font-family: FZLTHK--GBK1-0;
font-weight: normal;
text-align: center;
white-space: nowrap;
line-height: 50rpx;
margin-right: 24rpx;
}
.datepick view
{
display: inline-block;
}
</style>