Skip to content

Commit dabe60b

Browse files
author
ZEE.KIM
committed
fixed on vuejs 1.0.12
1 parent fce775e commit dabe60b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

calendar.vue

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,45 +48,45 @@ module.exports = {
4848
props: {
4949
show: {
5050
type: Boolean,
51-
required: true,
52-
twoWay: true
51+
twoWay: true,
52+
default:false
5353
},
5454
type: {
5555
type: String,
56-
required: true
56+
default:"date"
5757
},
5858
value: {
5959
type: String,
60-
required: true,
61-
twoWay: true
60+
twoWay: true,
61+
default:""
6262
},
6363
x: {
6464
type: Number,
65-
required: true,
6665
default:0
6766
},
6867
y: {
6968
type: Number,
70-
required: true,
7169
default:0
7270
},
7371
begin: {
74-
type: String
72+
type: String,
73+
default:""
7574
},
7675
end: {
77-
type: String
76+
type: String,
77+
default:""
7878
},
7979
range: {
8080
type: Boolean,
8181
default:false
8282
},
8383
rangeBegin:{
8484
type: Array,
85-
default:[]
85+
default:Array
8686
},
8787
rangeEnd:{
8888
type: Array,
89-
default:[]
89+
default:Array
9090
}
9191
},
9292
data:function(){
@@ -105,7 +105,7 @@ module.exports = {
105105
months:['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
106106
}
107107
},
108-
ready:function(){
108+
created:function(){
109109
var that=this;
110110
var now = new Date();
111111
if(that.value!=""){
@@ -147,26 +147,28 @@ module.exports = {
147147
that.minute = that.zero(now.getMinutes());
148148
that.second = that.zero(now.getSeconds());
149149
if(that.range){
150-
that.rangeBegin=[];
151-
that.rangeEnd=[];
150+
that.rangeBegin=Array;
151+
that.rangeEnd=Array;
152152
}
153153
}
154154
that.render(that.year,that.month);
155-
155+
},
156+
watch:{
157+
year:function(val,old){
158+
console.log("new %s old %s time:%s",val,old,+new Date);
159+
}
156160
},
157161
methods:{
158162
zero:function(n){
159163
return n<10?'0'+n:n;
160164
},
161165
render:function(y,m){
162166
var that=this;
163-
var d = new Date(),
164-
firstDayOfMonth = new Date(y, m, 1).getDay(),//当月第一天
165-
lastDateOfMonth = new Date(y, m + 1, 0).getDate(),//当月最后一天
166-
lastDayOfLastMonth = m == 0 ? new Date(y - 1, 11, 0).getDate() : new Date(y, m, 0).getDate();//最后一月的最后一天
167+
var firstDayOfMonth = new Date(y, m, 1).getDay();//当月第一天
168+
var lastDateOfMonth = new Date(y, m + 1, 0).getDate();//当月最后一天
169+
var lastDayOfLastMonth = new Date(y, m, 0).getDate();//最后一月的最后一天
167170
that.year=y;
168171
that.currentMonth=that.months[m];
169-
170172
var seletSplit=that.value.split(" ")[0].split(that.sep);
171173
var i,line=0,temp=[];
172174
for(i=1;i <= lastDateOfMonth;i++) {
@@ -276,8 +278,6 @@ module.exports = {
276278
select:function(k1,k2,e){
277279
if(e!=undefined)e.stopPropagation();
278280
var that=this;
279-
280-
281281
// 日期范围
282282
if(that.range){
283283
if(that.rangeBegin.length==0||that.rangeEndTemp!=0){
@@ -340,7 +340,7 @@ module.exports = {
340340
}
341341
</script>
342342

343-
<style>
343+
<style scope>
344344
.calendar {
345345
width: 300px;
346346
padding: 10px;

0 commit comments

Comments
 (0)