Authored by weiqingting

tijiao

@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </thead> 17 </thead>
18 <tbody> 18 <tbody>
19 <tr v-for="week in calendar"> 19 <tr v-for="week in calendar">
20 - <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> 20 + <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>
21 </tr> 21 </tr>
22 </tbody> 22 </tbody>
23 </table> 23 </table>
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 </template> 25 </template>
26 <script> 26 <script>
27 export default { 27 export default {
28 - props:["dateTime","mo"], 28 + props:["dateTime","mo","state"],
29 data(){ 29 data(){
30 return { 30 return {
31 // date: new Date(this.dateText), 31 // date: new Date(this.dateText),
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 } 35 }
36 }, 36 },
37 computed: { 37 computed: {
  38 +
38 month() { 39 month() {
39 return this.months[this.dateTime.month] 40 return this.months[this.dateTime.month]
40 }, 41 },
@@ -95,8 +96,8 @@ @@ -95,8 +96,8 @@
95 this.currentDay = "" 96 this.currentDay = ""
96 this.dateTime.month+=1 97 this.dateTime.month+=1
97 }, 98 },
98 - selectDate(value) {  
99 - if (! value.day || value.day === 32) { 99 + selectDate(value,index) {
  100 + if(this.isnot(value,index)){
100 return 101 return
101 } 102 }
102 this.dateTime.date=value.day 103 this.dateTime.date=value.day
@@ -104,6 +105,13 @@ @@ -104,6 +105,13 @@
104 }, 105 },
105 tomonth(){ 106 tomonth(){
106 this.mo="month" 107 this.mo="month"
  108 + },
  109 + isnot(day,index){
  110 + console.log(this.state);
  111 + if(this.state=="week"){
  112 + return ! day.day || day.day === 32||index!==0;
  113 + }
  114 + return ! day.day || day.day === 32;
107 } 115 }
108 }, 116 },
109 ready() { 117 ready() {
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <template> 23 <template>
24 <input type="text" class="form-control" @click="showCalendar" :value="date"> 24 <input type="text" class="form-control" @click="showCalendar" :value="date">
25 <div class="datepicker datepicker-dropdown dropdown-menu vue-show" :style="{'left':x+'px','top':y+'px'}" v-show="isshow"> 25 <div class="datepicker datepicker-dropdown dropdown-menu vue-show" :style="{'left':x+'px','top':y+'px'}" v-show="isshow">
26 - <date-days :date-time.sync="dateTime" :mo.sync="mo" v-show="mo==='day'"></date-days> 26 + <date-days :date-time.sync="dateTime" :mo.sync="mo" :state="state" v-show="mo==='day'"></date-days>
27 <date-months :date-time.sync="dateTime" :mo.sync="mo" v-show="mo==='month'"></date-months> 27 <date-months :date-time.sync="dateTime" :mo.sync="mo" v-show="mo==='month'"></date-months>
28 </div> 28 </div>
29 </template> 29 </template>
@@ -35,6 +35,10 @@ import dateMonths from "./dateMonths.vue" @@ -35,6 +35,10 @@ import dateMonths from "./dateMonths.vue"
35 value:{ 35 value:{
36 type:String 36 type:String
37 }, 37 },
  38 + state:{
  39 + type:String,
  40 + default:''
  41 + },
38 format:{ 42 format:{
39 type:String, 43 type:String,
40 default:"yyyy-MM-dd" 44 default:"yyyy-MM-dd"