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
af0d7288
Commit
af0d7288
authored
Dec 08, 2016
by
Leopoldthecoder
Committed by
cinwell.li
Dec 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Select: fix clearable still working bug in disabled mode
parent
88a5772e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
28 deletions
+17
-28
packages/select/src/option.vue
packages/select/src/option.vue
+1
-1
packages/select/src/select.vue
packages/select/src/select.vue
+16
-27
No files found.
packages/select/src/option.vue
View file @
af0d7288
...
...
@@ -121,7 +121,7 @@
created
()
{
this
.
parent
.
options
.
push
(
this
);
if
(
this
.
parent
.
remote
)
this
.
parent
.
cachedOptions
.
push
(
this
);
this
.
parent
.
cachedOptions
.
push
(
this
);
this
.
parent
.
optionsCount
++
;
this
.
parent
.
filteredOptionsCount
++
;
this
.
index
=
this
.
parent
.
options
.
indexOf
(
this
);
...
...
packages/select/src/select.vue
View file @
af0d7288
...
...
@@ -102,27 +102,17 @@
computed
:
{
iconClass
()
{
return
this
.
showCloseIcon
?
'
circle-close
'
:
(
this
.
remote
&&
this
.
filterable
?
''
:
'
caret-top
'
);
},
debounce
()
{
return
this
.
remote
?
300
:
0
;
},
showCloseIcon
()
{
let
criteria
=
this
.
clearable
&&
!
this
.
disabled
&&
this
.
inputHovering
&&
!
this
.
multiple
&&
this
.
value
!==
undefined
&&
this
.
value
!==
''
;
if
(
!
this
.
$el
)
return
false
;
this
.
$nextTick
(()
=>
{
let
icon
=
this
.
$el
.
querySelector
(
'
.el-input__icon
'
);
if
(
icon
)
{
criteria
?
addClass
(
icon
,
'
is-show-close
'
)
:
removeClass
(
icon
,
'
is-show-close
'
);
}
});
return
criteria
;
return
criteria
?
'
circle-close is-show-close
'
:
(
this
.
remote
&&
this
.
filterable
?
''
:
'
caret-top
'
);
},
debounce
()
{
return
this
.
remote
?
300
:
0
;
},
emptyText
()
{
...
...
@@ -217,13 +207,13 @@
}
else
{
this
.
currentPlaceholder
=
this
.
cachedPlaceHolder
;
}
this
.
dispatch
(
'
ElFormItem
'
,
'
el.form.change
'
,
val
);
}
this
.
se
lected
=
this
.
ge
tSelected
();
this
.
setSelected
();
if
(
this
.
filterable
&&
!
this
.
multiple
)
{
this
.
inputLength
=
20
;
}
this
.
$emit
(
'
change
'
,
val
);
this
.
dispatch
(
'
ElFormItem
'
,
'
el.form.change
'
,
val
);
},
query
(
val
)
{
...
...
@@ -296,7 +286,7 @@
}
let
inputs
=
this
.
$el
.
querySelectorAll
(
'
input
'
);
if
([].
indexOf
.
call
(
inputs
,
document
.
activeElement
)
===
-
1
)
{
this
.
se
lected
=
this
.
ge
tSelected
();
this
.
setSelected
();
}
}
},
...
...
@@ -338,8 +328,7 @@
},
getOption
(
value
)
{
const
option
=
(
this
.
remote
?
this
.
cachedOptions
:
this
.
options
)
.
filter
(
option
=>
option
.
value
===
value
)[
0
];
const
option
=
this
.
cachedOptions
.
filter
(
option
=>
option
.
value
===
value
)[
0
];
if
(
option
)
return
option
;
const
label
=
typeof
value
===
'
string
'
||
typeof
value
===
'
number
'
?
value
:
''
;
...
...
@@ -353,11 +342,12 @@
return
newOption
;
},
g
etSelected
()
{
s
etSelected
()
{
if
(
!
this
.
multiple
)
{
let
option
=
this
.
getOption
(
this
.
value
);
this
.
selectedLabel
=
option
.
currentLabel
;
return
option
;
this
.
selected
=
option
;
return
;
}
let
result
=
[];
if
(
Array
.
isArray
(
this
.
value
))
{
...
...
@@ -365,11 +355,11 @@
result
.
push
(
this
.
getOption
(
value
));
});
}
return
result
;
this
.
selected
=
result
;
},
handleIconClick
(
event
)
{
if
(
this
.
iconClass
===
'
circle-close
'
)
{
if
(
this
.
iconClass
.
indexOf
(
'
circle-close
'
)
>
-
1
)
{
this
.
deleteSelected
(
event
);
}
else
{
this
.
toggleMenu
();
...
...
@@ -535,7 +525,6 @@
deleteSelected
(
event
)
{
event
.
stopPropagation
();
this
.
$emit
(
'
input
'
,
''
);
this
.
$emit
(
'
change
'
,
''
);
this
.
visible
=
false
;
},
...
...
@@ -576,6 +565,7 @@
if
(
!
this
.
multiple
&&
Array
.
isArray
(
this
.
value
))
{
this
.
$emit
(
'
input
'
,
''
);
}
this
.
setSelected
();
this
.
debouncedOnInputChange
=
debounce
(
this
.
debounce
,
()
=>
{
this
.
onInputChange
();
...
...
@@ -590,7 +580,6 @@
this
.
currentPlaceholder
=
''
;
}
addResizeListener
(
this
.
$el
,
this
.
resetInputWidth
);
this
.
selected
=
this
.
getSelected
();
if
(
this
.
remote
&&
this
.
multiple
)
{
this
.
resetInputHeight
();
}
...
...
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