Authored by weiqingting

tijiao

... ... @@ -17,7 +17,7 @@
</thead>
<tbody>
<tr v-for="week in calendar">
<td :class="{today: day.date.toDateString() === new Date().toDateString(), selected: day.day === this.currentDay, not: ! day.day || day.day === 32}" v-for="day in week" track-by="$index" v-text="day.day === 32 ? '' : day.day" @click="selectDate(day)"></td>
<td :class="{today: day.date.toDateString() === new Date().toDateString(), selected: day.day === this.currentDay, old: isnot(day,$index)}" v-for="day in week" track-by="$index" v-text="day.day === 32 ? '' : day.day" @click="selectDate(day,$index)"></td>
</tr>
</tbody>
</table>
... ... @@ -25,7 +25,7 @@
</template>
<script>
export default {
props:["dateTime","mo"],
props:["dateTime","mo","state"],
data(){
return {
// date: new Date(this.dateText),
... ... @@ -35,6 +35,7 @@
}
},
computed: {
month() {
return this.months[this.dateTime.month]
},
... ... @@ -95,8 +96,8 @@
this.currentDay = ""
this.dateTime.month+=1
},
selectDate(value) {
if (! value.day || value.day === 32) {
selectDate(value,index) {
if(this.isnot(value,index)){
return
}
this.dateTime.date=value.day
... ... @@ -104,6 +105,13 @@
},
tomonth(){
this.mo="month"
},
isnot(day,index){
console.log(this.state);
if(this.state=="week"){
return ! day.day || day.day === 32||index!==0;
}
return ! day.day || day.day === 32;
}
},
ready() {
... ...
... ... @@ -23,7 +23,7 @@
<template>
<input type="text" class="form-control" @click="showCalendar" :value="date">
<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" v-show="mo==='day'"></date-days>
<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>
</div>
</template>
... ... @@ -35,6 +35,10 @@ import dateMonths from "./dateMonths.vue"
value:{
type:String
},
state:{
type:String,
default:''
},
format:{
type:String,
default:"yyyy-MM-dd"
... ...