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
069d96a8
Commit
069d96a8
authored
Sep 06, 2019
by
Cr
Committed by
hetech
Sep 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Table: fixed row-style with display not work (#17002)
parent
90c5d74f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
packages/table/src/table-body.js
packages/table/src/table-body.js
+6
-2
test/unit/specs/table.spec.js
test/unit/specs/table.spec.js
+7
-3
No files found.
packages/table/src/table-body.js
View file @
069d96a8
...
@@ -321,9 +321,13 @@ export default {
...
@@ -321,9 +321,13 @@ export default {
rowClasses
.
push
(
'
el-table__row--level-
'
+
treeRowData
.
level
);
rowClasses
.
push
(
'
el-table__row--level-
'
+
treeRowData
.
level
);
display
=
treeRowData
.
display
;
display
=
treeRowData
.
display
;
}
}
// 指令 v-show 会覆盖 row-style 中 display
// 使用 :style 代替 v-show https://github.com/ElemeFE/element/issues/16995
let
displayStyle
=
display
?
null
:
{
display
:
'
none
'
};
return
(
<
tr
return
(
<
tr
v
-
show
=
{
display
}
style
=
{
[
displayStyle
,
this
.
getRowStyle
(
row
,
$index
)]
}
style
=
{
this
.
getRowStyle
(
row
,
$index
)
}
class
=
{
rowClasses
}
class
=
{
rowClasses
}
key
=
{
this
.
getKeyOfRow
(
row
,
$index
)
}
key
=
{
this
.
getKeyOfRow
(
row
,
$index
)
}
on
-
dblclick
=
{
(
$event
)
=>
this
.
handleDoubleClick
(
$event
,
row
)
}
on
-
dblclick
=
{
(
$event
)
=>
this
.
handleDoubleClick
(
$event
,
row
)
}
...
...
test/unit/specs/table.spec.js
View file @
069d96a8
...
@@ -182,7 +182,7 @@ describe('Table', () => {
...
@@ -182,7 +182,7 @@ describe('Table', () => {
methods
:
{
methods
:
{
tableRowStyle
({
row
,
rowIndex
})
{
tableRowStyle
({
row
,
rowIndex
})
{
if
(
rowIndex
===
1
)
{
if
(
rowIndex
===
1
)
{
return
{
height
:
'
60px
'
};
return
{
height
:
'
60px
'
,
display
:
'
none
'
};
}
}
return
null
;
return
null
;
...
@@ -191,8 +191,12 @@ describe('Table', () => {
...
@@ -191,8 +191,12 @@ describe('Table', () => {
});
});
setTimeout
(
_
=>
{
setTimeout
(
_
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.el-table__body tr:nth-child(1)
'
).
style
.
height
).
to
.
equal
(
''
);
let
child1
=
vm
.
$el
.
querySelector
(
'
.el-table__body tr:nth-child(1)
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-table__body tr:nth-child(2)
'
).
style
.
height
).
to
.
equal
(
'
60px
'
);
let
child2
=
vm
.
$el
.
querySelector
(
'
.el-table__body tr:nth-child(2)
'
);
expect
(
child1
.
style
.
height
).
to
.
equal
(
''
);
expect
(
child1
.
style
.
display
).
to
.
equal
(
''
);
expect
(
child2
.
style
.
height
).
to
.
equal
(
'
60px
'
);
expect
(
child2
.
style
.
display
).
to
.
equal
(
'
none
'
);
destroyVM
(
vm
);
destroyVM
(
vm
);
done
();
done
();
},
DELAY
);
},
DELAY
);
...
...
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