Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
3cf5fd94
Commit
3cf5fd94
authored
May 19, 2017
by
liyangworld
Committed by
杨奕
Jul 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
date-picker : fix disabledDate bug 。
未改之前,设置禁用日期后,年和月的禁用状态不准。因为只选取了年和月的某一天进行判断。修改为年和月的每一天都进行判断。
parent
be6cc780
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
6 deletions
+41
-6
packages/date-picker/src/basic/month-table.vue
packages/date-picker/src/basic/month-table.vue
+21
-3
packages/date-picker/src/basic/year-table.vue
packages/date-picker/src/basic/year-table.vue
+20
-3
No files found.
packages/date-picker/src/basic/month-table.vue
View file @
3cf5fd94
...
...
@@ -63,11 +63,29 @@
methods
:
{
getCellStyle
(
month
)
{
const
style
=
{};
const
date
=
new
Date
(
this
.
date
);
var
year
=
this
.
date
.
getFullYear
();
var
date
=
new
Date
(
0
);
date
.
setFullYear
(
year
);
date
.
setMonth
(
month
);
style
.
disabled
=
typeof
this
.
disabledDate
===
'
function
'
&&
this
.
disabledDate
(
date
);
date
.
setHours
(
0
);
var
nextMonth
=
new
Date
(
date
);
nextMonth
.
setMonth
(
month
+
1
);
var
flag
=
false
;
if
(
typeof
this
.
disabledDate
===
'
function
'
)
{
while
(
date
<
nextMonth
)
{
if
(
this
.
disabledDate
(
date
))
{
date
=
new
Date
(
date
.
getTime
()
+
8.64e7
);
}
else
{
break
;
}
}
if
((
date
-
nextMonth
)
===
0
)
flag
=
true
;
}
style
.
disabled
=
flag
;
style
.
current
=
this
.
month
===
month
;
return
style
;
...
...
packages/date-picker/src/basic/year-table.vue
View file @
3cf5fd94
...
...
@@ -62,11 +62,28 @@
methods
:
{
getCellStyle
(
year
)
{
const
style
=
{};
const
date
=
new
Date
(
this
.
date
);
var
date
=
new
Date
(
0
);
date
.
setFullYear
(
year
);
style
.
disabled
=
typeof
this
.
disabledDate
===
'
function
'
&&
this
.
disabledDate
(
date
);
date
.
setHours
(
0
);
var
nextYear
=
new
Date
(
date
);
nextYear
.
setFullYear
(
year
+
1
);
var
flag
=
false
;
if
(
typeof
this
.
disabledDate
===
'
function
'
)
{
while
(
date
<
nextYear
)
{
if
(
this
.
disabledDate
(
date
))
{
date
=
new
Date
(
date
.
getTime
()
+
8.64e7
);
}
else
{
break
;
}
}
if
((
date
-
nextYear
)
===
0
)
flag
=
true
;
}
style
.
disabled
=
flag
;
style
.
current
=
Number
(
this
.
year
)
===
year
;
return
style
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment