Authored by weiqingting

时间控件

... ... @@ -101,6 +101,7 @@
return
}
this.dateTime.date=value.day
this.dateTime._hasdefault=true
this.mo=''
},
tomonth(){
... ...
... ... @@ -47,6 +47,7 @@ export default {
selectMonth(value){
this.dateTime.month=+value-1
this.mo=''
this.dateTime._hasdefault=true
}
},
ready() {
... ...
... ... @@ -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
... ...
... ... @@ -77,13 +77,18 @@
required: true
}
},
data(){
return {
params:{}
}
},
methods: {
getParam:function(param){
var me=this;
param=param||{};
param.page=me.page||1;
param.size=me.pageSize;
return param;
me.params=param||me.params;
me.params.page=me.page||1;
me.params.size=me.pageSize;
return me.params;
},
resquest:function(param){
var me=this;
... ...