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.
48 lines
930 B
48 lines
930 B
<template>
|
|
<view>
|
|
<view @tap="$refs.calendar.open()" hover-class="cc-active">
|
|
<view class="iconfont icon-calendar timer"><text class="padding-left-xs">{{ date }}</text></view>
|
|
</view>
|
|
<uni-calendar @confirm="handleChange" :insert="false" :range="false" :show-month="true" ref="calendar" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'DateSelector',
|
|
data() {
|
|
const time = this.$moment().format('YYYY-MM-DD');
|
|
return {
|
|
time,
|
|
};
|
|
},
|
|
|
|
computed: {
|
|
date() {
|
|
const {
|
|
time
|
|
} = this;
|
|
return time;
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
/**
|
|
* 日历确认选择了时间段
|
|
* @param {object} value 日历返回对象
|
|
*/
|
|
handleChange(value) {
|
|
console.log('value', value.fulldate)
|
|
this.time = value.fulldate;
|
|
this.$emit('change', this.time);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.timer {
|
|
font-size: 34rpx !important;
|
|
color: $gray;
|
|
}
|
|
</style>
|
|
|