...
|
...
|
@@ -21,7 +21,7 @@ |
|
|
}
|
|
|
</style>
|
|
|
<template>
|
|
|
<input type="text" class="form-control" @click="showCalendar" :value="date">
|
|
|
<input type="text" class="form-control" @click="showCalendar" :value="date" :placeholder="placeholder">
|
|
|
<div class="datepicker datepicker-dropdown dropdown-menu vue-show" :style="{'left':x+'px','top':y+'px'}" v-show="isshow">
|
|
|
<date-days :date-time.sync="dateTime" :mo.sync="mo" :state="state" v-show="mo==='day'"></date-days>
|
|
|
<date-months :date-time.sync="dateTime" :mo.sync="mo" v-show="mo==='month'"></date-months>
|
...
|
...
|
@@ -33,7 +33,8 @@ import dateMonths from "./dateMonths.vue" |
|
|
export default {
|
|
|
props:{
|
|
|
value:{
|
|
|
type:String
|
|
|
type:String,
|
|
|
default:''
|
|
|
},
|
|
|
state:{
|
|
|
type:String,
|
...
|
...
|
@@ -42,6 +43,10 @@ import dateMonths from "./dateMonths.vue" |
|
|
format:{
|
|
|
type:String,
|
|
|
default:"yyyy-MM-dd"
|
|
|
},
|
|
|
placeholder:{
|
|
|
type:String,
|
|
|
default:'选择时间'
|
|
|
}
|
|
|
},
|
|
|
components:{
|
...
|
...
|
@@ -69,10 +74,10 @@ import dateMonths from "./dateMonths.vue" |
|
|
},
|
|
|
computed:{
|
|
|
date(){
|
|
|
if(this.dateTime.year){
|
|
|
if(this.dateTime.year&&this.dateTime._hasdefault){
|
|
|
this.value=this.showDate(this.dateTime,this.format);
|
|
|
}
|
|
|
return this.showDate(this.dateTime,this.format);
|
|
|
return this.value;
|
|
|
},
|
|
|
isshow(){
|
|
|
return this.mo?true:false;
|
...
|
...
|
@@ -116,9 +121,13 @@ import dateMonths from "./dateMonths.vue" |
|
|
date:dateTime.getDate(),
|
|
|
hour:dateTime.getHours(),
|
|
|
minute:dateTime.getMinutes(),
|
|
|
second:dateTime.getSeconds()
|
|
|
second:dateTime.getSeconds(),
|
|
|
_hasdefault:this.value?true:false
|
|
|
}
|
|
|
if(this.value){
|
|
|
this.value=this.showDate(this.dateTime,this.format);
|
|
|
}
|
|
|
this.value=this.showDate(this.dateTime,this.format);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
</script> |
|
|
\ No newline at end of file |
...
|
...
|
|