<template>
	<view class="alldata flexc">
		<!-- :start="startDate" :end="endDate" -->
		<picker mode="date" class="flexc" :value="date"  @change="bindDateChange" :fields="fields">
		<view class="alldatain f15 cofe f500" :style="'text-align:'+textAlign">{{date||timetxt}}</view>
		
		</picker>
		<image :src="upimg"></image>
	</view>
</template>

<script>
	export default{
		props:{
			textAlign:{
				type: String,
				default () {
					return 'left'
				}
			},
			fields:{
				type: String,
				default () {
					return 'year'
				}
			},
			timetxt:{
				type: String,
				default () {
					return '选择年份'
				}
			},
			timedate:{
				type: String,
				default () {
					return ''
				}
			}
			
		},
		data(){
			return{
				upimg:require("@/static/images/index/up.png"),
				date:''
			}
		},
		mounted() {
			if(this.timedate){
				this.date=this.timedate;
			}
		},
		methods:{
			bindDateChange(e){
				var val=e.detail.value
				this.date=e.detail.value;
				this.$emit("bindDateChange",val)
			}
		}
	}
</script>

<style lang="scss" scoped>
 // 选择年份
 .alldata{padding: 20rpx;height: 80rpx;box-sizing: border-box;
	image{width: 22rpx;height: 16rpx;margin-left: 14rpx;}
	.alldatain{min-width: 124rpx;}
 }	
</style>