Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lihuizhen
ec-report-refactor
Commits
85a8d99c
Commit
85a8d99c
authored
Mar 07, 2023
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: table calculate height
parent
ab87837d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
NormalTable.vue
components/NormalTable/NormalTable.vue
+25
-2
No files found.
components/NormalTable/NormalTable.vue
View file @
85a8d99c
...
@@ -80,7 +80,7 @@
...
@@ -80,7 +80,7 @@
backgroundColor
:
headerBackgroundColor
,
backgroundColor
:
headerBackgroundColor
,
titlePostion
:
headerTitlePostion
,
titlePostion
:
headerTitlePostion
,
titleFontSize
:
headerTitleFontSize
titleFontSize
:
headerTitleFontSize
}
=
this
.
elementInfo
.
table
.
tableHeader
}
=
this
.
elementInfo
.
table
.
tableHeader
const
cellWidth
=
this
.
elementInfo
.
table
.
column
.
length
>
10
?
130
:
240
const
cellWidth
=
this
.
elementInfo
.
table
.
column
.
length
>
10
?
130
:
240
return
{
return
{
'--table-width'
:
`${cellWidth * this.elementInfo.table.column.length
}
rpx`
,
'--table-width'
:
`${cellWidth * this.elementInfo.table.column.length
}
rpx`
,
...
@@ -128,8 +128,31 @@
...
@@ -128,8 +128,31 @@
}
)
}
)
that
.
elementInfo
.
table
.
column
=
columns
that
.
elementInfo
.
table
.
column
=
columns
}
}
that
.
chartTables
=
that
.
elementData
.
dataList
.
chartTables
that
.
chartTables
=
that
.
elementData
.
dataList
.
chartTables
// if(that.elementInfo.table.tableCell.autoHeight)
{
that
.
calculateCellHeight
()
//
}
}
)
}
)
}
,
calculateCellHeight
()
{
var
query
=
wx
.
createSelectorQuery
().
in
(
this
);
query
.
select
(
".normal-table"
).
boundingClientRect
(
res
=>
{
const
height
=
res
.
height
// 计算table的高度
var
{
cellRowHeight
,
}
=
this
.
elementInfo
.
table
.
tableCell
const
{
headerRowHeight
,
}
=
this
.
elementInfo
.
table
.
tableHeader
const
padding
=
20
const
tableHeight
=
padding
+
parseInt
(
headerRowHeight
)
+
(
padding
+
parseInt
(
cellRowHeight
))
*
this
.
chartTables
.
length
if
(
height
-
tableHeight
-
padding
>
this
.
chartTables
.
length
)
{
cellRowHeight
=
(
height
-
padding
-
parseInt
(
headerRowHeight
)
-
padding
-
padding
*
this
.
chartTables
.
length
)
/
this
.
chartTables
.
length
this
.
elementInfo
.
table
.
tableCell
.
cellRowHeight
=
cellRowHeight
}
}
).
exec
();
}
,
}
,
tableCellStyle
(
column
,
index
)
{
tableCellStyle
(
column
,
index
)
{
...
...
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