@wanghao001/time-pick
v0.0.8
Published
当前控件是可选择日月季年时间的控件 使用方法: <time-pick v-if="isSHow" :cancleFn="showTime" :time="true" :defaultValue="defaultValue" @btnSure="btnSure" :arrayFirstdayAndLastday="['2018.1.1', lastDay]"></time-pick> <script> data(){ return {
Downloads
3
Readme
当前控件是可选择日月季年时间的控件
使用方法:
<time-pick v-if="isSHow" :cancleFn="showTime" :time="true" :defaultValue="defaultValue" @btnSure="btnSure"
:arrayFirstdayAndLastday="['2018.1.1', lastDay]">
data(){
return {
isSHow:false,//控制是否显示控件
lastDay:'',//控制最后时间
defaultValue:[]//初始值数组['2021','1','1']
}
},
created() {
this.timeInit()
},
methods: {
showTime(){ //控制显示隐藏控件
this.isSHow = !this.isSHow
},
btnSure(v,t){ //确定按钮返回所选时间
console.log(v,t)
this.isSHow = false
},
timeInit() {
const time = new Date();
const yearNow = +time.getFullYear();
const monthNow = +time.getMonth() + 1;
const dayNow = +time.getDate();
this.lastDay = ${yearNow}.${monthNow}.${dayNow}
;
this.defaultValue = [yearNow, monthNow, dayNow];
},
},
}