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
36d4f0a6
Commit
36d4f0a6
authored
Sep 14, 2017
by
Leopoldthecoder
Committed by
杨奕
Sep 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Select: move setSelect to mounted hook
parent
a750f5d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
packages/select/src/select.vue
packages/select/src/select.vue
+2
-3
test/unit/specs/select.spec.js
test/unit/specs/select.spec.js
+13
-11
No files found.
packages/select/src/select.vue
View file @
36d4f0a6
...
@@ -660,8 +660,7 @@
...
@@ -660,8 +660,7 @@
},
},
getValueKey
(
item
)
{
getValueKey
(
item
)
{
const
type
=
typeof
item
.
value
;
if
(
Object
.
prototype
.
toString
.
call
(
item
.
value
).
toLowerCase
()
!==
'
[object object]
'
)
{
if
(
type
===
'
number
'
||
type
===
'
string
'
)
{
return
item
.
value
;
return
item
.
value
;
}
else
{
}
else
{
return
getValueByPath
(
item
.
value
,
this
.
valueKey
);
return
getValueByPath
(
item
.
value
,
this
.
valueKey
);
...
@@ -677,7 +676,6 @@
...
@@ -677,7 +676,6 @@
if
(
!
this
.
multiple
&&
Array
.
isArray
(
this
.
value
))
{
if
(
!
this
.
multiple
&&
Array
.
isArray
(
this
.
value
))
{
this
.
$emit
(
'
input
'
,
''
);
this
.
$emit
(
'
input
'
,
''
);
}
}
this
.
setSelected
();
this
.
debouncedOnInputChange
=
debounce
(
this
.
debounce
,
()
=>
{
this
.
debouncedOnInputChange
=
debounce
(
this
.
debounce
,
()
=>
{
this
.
onInputChange
();
this
.
onInputChange
();
...
@@ -701,6 +699,7 @@
...
@@ -701,6 +699,7 @@
this
.
inputWidth
=
this
.
$refs
.
reference
.
$el
.
getBoundingClientRect
().
width
;
this
.
inputWidth
=
this
.
$refs
.
reference
.
$el
.
getBoundingClientRect
().
width
;
}
}
});
});
this
.
setSelected
();
},
},
beforeDestroy
()
{
beforeDestroy
()
{
...
...
test/unit/specs/select.spec.js
View file @
36d4f0a6
...
@@ -585,8 +585,9 @@ describe('Select', () => {
...
@@ -585,8 +585,9 @@ describe('Select', () => {
}
}
}
}
},
true
);
},
true
);
const
tagCloseIcons
=
vm
.
$el
.
querySelectorAll
(
'
.el-tag__close
'
);
expect
(
vm
.
value
.
length
).
to
.
equal
(
2
);
expect
(
vm
.
value
.
length
).
to
.
equal
(
2
);
setTimeout
(()
=>
{
const
tagCloseIcons
=
vm
.
$el
.
querySelectorAll
(
'
.el-tag__close
'
);
tagCloseIcons
[
1
].
click
();
tagCloseIcons
[
1
].
click
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
vm
.
value
.
length
).
to
.
equal
(
1
);
expect
(
vm
.
value
.
length
).
to
.
equal
(
1
);
...
@@ -597,8 +598,9 @@ describe('Select', () => {
...
@@ -597,8 +598,9 @@ describe('Select', () => {
expect
(
window
.
console
.
log
.
callCount
).
to
.
equal
(
2
);
expect
(
window
.
console
.
log
.
callCount
).
to
.
equal
(
2
);
window
.
console
.
log
.
restore
();
window
.
console
.
log
.
restore
();
done
();
done
();
},
100
);
},
50
);
},
100
);
},
50
);
},
50
);
});
});
it
(
'
multiple limit
'
,
done
=>
{
it
(
'
multiple limit
'
,
done
=>
{
...
...
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