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
882a9d79
Commit
882a9d79
authored
Dec 26, 2016
by
baiyaaaaa
Committed by
cinwell.li
Dec 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add clearable api (#1994)
parent
6e428ffc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
5 deletions
+40
-5
examples/docs/en-US/date-picker.md
examples/docs/en-US/date-picker.md
+1
-0
examples/docs/en-US/datetime-picker.md
examples/docs/en-US/datetime-picker.md
+1
-0
examples/docs/en-US/time-picker.md
examples/docs/en-US/time-picker.md
+2
-1
examples/docs/zh-CN/date-picker.md
examples/docs/zh-CN/date-picker.md
+1
-0
examples/docs/zh-CN/datetime-picker.md
examples/docs/zh-CN/datetime-picker.md
+1
-0
examples/docs/zh-CN/time-picker.md
examples/docs/zh-CN/time-picker.md
+1
-0
packages/date-picker/src/picker.vue
packages/date-picker/src/picker.vue
+8
-4
test/unit/specs/date-picker.spec.js
test/unit/specs/date-picker.spec.js
+25
-0
No files found.
examples/docs/en-US/date-picker.md
View file @
882a9d79
...
...
@@ -256,6 +256,7 @@ Picking a date range is supported.
| disabled | whether DatePicker is disabled | boolean | - | false |
|size | size of Input | string | large/small/mini | — |
| editable | whether the input is editable | boolean | - | true |
| clearable | Whether to show clear button | boolean | - | true |
| placeholder | placeholder | string | — | — |
| type | type of the picker | string | year/month/date/datetime/ week/datetimerange/daterange | date |
| format | format of the picker | string | year
`yyyy`
month
`MM`
day
`dd`
, hour
`HH`
, minute
`mm`
, second
`ss`
| yyyy-MM-dd |
...
...
examples/docs/en-US/datetime-picker.md
View file @
882a9d79
...
...
@@ -210,6 +210,7 @@ Select date and time in one picker.
| readonly | whether DatePicker is read only | boolean | — | false |
| disabled | whether DatePicker is disabled | boolean | - | false |
| editable | whether the input is editable | boolean | - | true |
| clearable | Whether to show clear button | boolean | - | true |
|size | size of Input | string | large/small/mini | — |
| placeholder | placeholder | string | — | — |
| type | type of the picker | string | year/month/date/datetime/ week/datetimerange/daterange | date |
...
...
examples/docs/en-US/time-picker.md
View file @
882a9d79
...
...
@@ -146,7 +146,8 @@ Can pick an arbitrary time range.
| readonly | whether DatePicker is read only | boolean | — | false |
| disabled | whether DatePicker is disabled | boolean | - | false |
| editable | whether the input is editable | boolean | - | true |
|size | size of Input | string | large/small/mini | — |
| clearable | Whether to show clear button | boolean | - | true |
| size | size of Input | string | large/small/mini | — |
| placeholder | placeholder | string | — | — |
| format | format of the picker | string | hour
`HH`
, minute
`mm`
, second
`ss`
| HH:mm:ss |
| value | value of the picker | date for Time Picker, and string for Time Select | hour
`HH`
, minute
`mm`
, second
`ss`
| HH:mm:ss |
...
...
examples/docs/zh-CN/date-picker.md
View file @
882a9d79
...
...
@@ -289,6 +289,7 @@
| readonly | 完全只读 | boolean | — | false |
| disabled | 禁用 | boolean | - | false |
| editable | 文本框可输入 | boolean | - | true |
| clearable | 是否显示清除按钮 | boolean | - | true |
| size | 输入框尺寸 | string | large, small, mini | — |
| placeholder | 占位内容 | string | — | — |
| type | 显示类型 | string | year/month/date/week/ datetime/datetimerange/daterange | date |
...
...
examples/docs/zh-CN/datetime-picker.md
View file @
882a9d79
...
...
@@ -233,6 +233,7 @@
| readonly | 完全只读 | boolean | — | false |
| disabled | 禁用 | boolean | - | false |
| editable | 文本框可输入 | boolean | - | true |
| clearable | 是否显示清除按钮 | boolean | - | true |
| size | 输入框尺寸 | string | large, small, mini | — |
| placeholder | 占位内容 | string | — | — |
| type | 显示类型 | string | year/month/date/week/ datetime/datetimerange/daterange | date |
...
...
examples/docs/zh-CN/time-picker.md
View file @
882a9d79
...
...
@@ -153,6 +153,7 @@
| readonly | 完全只读 | boolean | — | false |
| disabled | 禁用 | boolean | - | false |
| editable | 文本框可输入 | boolean | - | true |
| clearable | 是否显示清除按钮 | boolean | - | true |
| size | 输入框尺寸 | string | large, small, mini | — |
| placeholder | 占位内容 | string | — | — |
| format | 时间格式化(TimePicker) | string | 小时:
`HH`
,分:
`mm`
,秒:
`ss`
| 'HH:mm:ss' |
...
...
packages/date-picker/src/picker.vue
View file @
882a9d79
...
...
@@ -187,6 +187,10 @@ export default {
readonly
:
Boolean
,
placeholder
:
String
,
disabled
:
Boolean
,
clearable
:
{
type
:
Boolean
,
default
:
true
},
popperClass
:
String
,
editable
:
{
type
:
Boolean
,
...
...
@@ -324,18 +328,18 @@ export default {
methods
:
{
handleMouseEnterIcon
()
{
if
(
this
.
readonly
||
this
.
disabled
)
return
;
if
(
!
this
.
valueIsEmpty
)
{
if
(
!
this
.
valueIsEmpty
&&
this
.
clearable
)
{
this
.
showClose
=
true
;
}
},
handleClickIcon
()
{
if
(
this
.
readonly
||
this
.
disabled
)
return
;
if
(
this
.
valueIsEmpty
)
{
this
.
pickerVisible
=
!
this
.
pickerVisible
;
}
else
{
if
(
this
.
showClose
)
{
this
.
internalValue
=
''
;
this
.
$emit
(
'
input
'
,
''
);
}
else
{
this
.
pickerVisible
=
!
this
.
pickerVisible
;
}
},
...
...
test/unit/specs/date-picker.spec.js
View file @
882a9d79
...
...
@@ -91,6 +91,31 @@ describe('DatePicker', () => {
},
DELAY
);
});
it
(
'
disabled clear value
'
,
done
=>
{
vm
=
createVue
({
template
:
`
<el-date-picker v-model="value" ref="compo" :clearable="false"></el-date-picker>
`
,
data
()
{
return
{
value
:
''
};
}
},
true
);
const
input
=
vm
.
$el
.
querySelector
(
'
input
'
);
input
.
focus
();
setTimeout
(
_
=>
{
const
$el
=
vm
.
$refs
.
compo
.
picker
.
$el
;
$el
.
querySelector
(
'
td.available
'
).
click
();
vm
.
$nextTick
(
_
=>
{
vm
.
$el
.
querySelector
(
'
.el-input__icon
'
).
click
();
setTimeout
(
_
=>
{
expect
(
vm
.
value
).
to
.
be
.
exist
;
done
();
},
DELAY
);
});
},
DELAY
);
});
it
(
'
reset
'
,
done
=>
{
vm
=
createVue
({
template
:
`
...
...
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