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
1dfe4c25
Commit
1dfe4c25
authored
Apr 29, 2022
by
chris.yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:table组件适配
parent
d61c184d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
4 deletions
+53
-4
Table.vue
components/Table/Table.vue
+53
-4
No files found.
components/Table/Table.vue
View file @
1dfe4c25
<
template
>
<
template
>
<view
class=
"normal-table"
>
<view
class=
"normal-table"
:style=
"
{ transform: `scale(${scale}) translate(${elementInfo.width * (scale - 1) /2}px, ${elementInfo.height * (scale - 1) /2}px)`}"
>
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<scroll-view
scroll-x=
"true"
class=
"scroll-view_H"
>
<scroll-view
scroll-x=
"true"
class=
"scroll-view_H"
>
<view
<view
class=
"table"
class=
"table"
:style=
"[tableStyle]"
:style=
"[tableStyle]"
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
mode=
"aspectFit"
mode=
"aspectFit"
:src=
"`$
{cell[item.dataIndex]}?${new Date().getTime()}`"
:src=
"`$
{cell[item.dataIndex]}?${new Date().getTime()}`"
crossOrigin="anonymous"
crossOrigin="anonymous"
style="width:100%"
@click="imageClick(cellIndex, item.dataIndex)"
@click="imageClick(cellIndex, item.dataIndex)"
>
</u-image>
>
</u-image>
</
template
>
</
template
>
...
@@ -46,7 +47,8 @@
...
@@ -46,7 +47,8 @@
left
:
'start'
,
left
:
'start'
,
center
:
'center'
,
center
:
'center'
,
right
:
'end'
right
:
'end'
}
}
,
scale
:
1
}
;
}
;
}
,
}
,
computed
:
{
computed
:
{
...
@@ -91,7 +93,13 @@
...
@@ -91,7 +93,13 @@
initChart
()
{
initChart
()
{
const
that
=
this
const
that
=
this
that
.
$nextTick
(()
=>
{
that
.
$nextTick
(()
=>
{
that
.
calculateScale
()
that
.
chartTables
=
that
.
elementData
.
dataList
.
chartTables
that
.
chartTables
=
that
.
elementData
.
dataList
.
chartTables
that
.
elementInfo
.
table
.
column
.
forEach
(
item
=>
{
if
(
item
.
slots
.
customRender
===
'picture'
)
{
// that.cacheImages(item.dataIndex)
}
}
)
}
)
}
)
}
,
}
,
cellClick
(
e
)
{
cellClick
(
e
)
{
...
@@ -101,18 +109,59 @@
...
@@ -101,18 +109,59 @@
uni
.
$emit
(
'handleLinkParams'
,
{
index
,
paramName
,
value
:
value
}
)
uni
.
$emit
(
'handleLinkParams'
,
{
index
,
paramName
,
value
:
value
}
)
}
,
}
,
calculateScale
()
{
var
query
=
wx
.
createSelectorQuery
().
in
(
this
);
query
.
select
(
".normal-table"
).
boundingClientRect
(
res
=>
{
const
w
=
res
.
width
const
{
width
,
height
}
=
this
.
elementInfo
const
scale
=
w
/
width
this
.
scale
=
scale
}
).
exec
();
}
,
// 图片增加点击事件,查看全部图片
// 图片增加点击事件,查看全部图片
imageClick
(
index
,
key
)
{
imageClick
(
index
,
key
)
{
const
images
=
[]
const
images
=
[]
var
caches
=
uni
.
getStorageSync
(
'cacheImages'
)
for
(
var
i
=
0
;
i
<
this
.
chartTables
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
chartTables
.
length
;
i
++
)
{
const
imageUrl
=
this
.
chartTables
[
i
][
key
]
const
imageUrl
=
this
.
chartTables
[
i
][
key
]
if
(
caches
.
hasOwnProperty
(
imageUrl
))
{
images
.
push
(
caches
[
imageUrl
])
}
else
{
images
.
push
(
imageUrl
)
images
.
push
(
imageUrl
)
}
}
}
uni
.
previewImage
({
uni
.
previewImage
({
current
:
index
,
current
:
index
,
urls
:
images
urls
:
images
}
)
}
)
}
,
/**
* 缓存图片数据
*/
cacheImages
(
key
)
{
var
caches
=
uni
.
getStorageSync
(
'cacheImages'
)
if
(
!
caches
)
{
caches
=
{
}
}
this
.
chartTables
.
forEach
(
item
=>
{
// 如果包含当前url,就不再下载
const
url
=
item
[
key
]
if
(
!
caches
.
hasOwnProperty
(
url
))
{
uni
.
downloadFile
({
url
:
url
,
success
:
(
res
)
=>
{
if
(
res
.
statusCode
===
200
)
{
caches
[
url
]
=
res
.
tempFilePath
uni
.
setStorageSync
(
'cacheImages'
,
caches
)
}
}
}
)
}
}
)
}
}
}
}
}
}
<
/script
>
<
/script
>
...
...
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