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
fc407217
Commit
fc407217
authored
Feb 25, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 减少页面dom层级
parent
66f3b11f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
69 deletions
+60
-69
index.vue
pages/index/index.vue
+60
-69
No files found.
pages/index/index.vue
View file @
fc407217
<
template
>
<view
class=
"canvas"
:style=
"[styleObject]"
>
<view
class=
"viewport-wrapper"
:style=
"
{
width: `${reportInfo.width * scale}px`,
height: `${reportInfo.height * scale}px`
}">
<view
class=
"viewport-wrapper"
:style=
"[styleObject]"
>
<template
v-for=
"(element, index) in reportData"
>
<view
class=
"view-element"
...
...
@@ -60,7 +53,6 @@
</view>
</
template
>
</view>
</view>
</template>
<
script
>
...
...
@@ -75,9 +67,11 @@
computed
:
{
styleObject
()
{
let
params
=
{}
const
{
backgroundColor
,
backgroundImage
}
=
this
.
reportInfo
const
{
backgroundColor
,
backgroundImage
,
width
,
height
}
=
this
.
reportInfo
if
(
backgroundImage
)
params
=
{
'background-image'
:
`url(
${
backgroundImage
}
)`
}
return
{
width
:
`
${
width
*
this
.
scale
}
px`
,
height
:
`
${
height
*
this
.
scale
}
px`
,
'background-color'
:
backgroundColor
,
...
params
}
...
...
@@ -90,7 +84,6 @@
},
onLoad
()
{
this
.
userAuthCheck
()
this
.
getReportCharts
()
/**
* 组件交互 - 参数
*/
...
...
@@ -111,6 +104,7 @@
onUnload
()
{
// 移除监听事件
uni
.
$off
(
'handleLinkParams'
)
uni
.
$off
(
'handleLinkComp'
)
clearInterval
(
this
.
timename
)
},
methods
:
{
...
...
@@ -121,7 +115,7 @@
var
authorized
=
uni
.
getStorageSync
(
'authorized'
)
if
(
userId
)
{
if
(
authorized
)
{
this
.
getReportCharts
()
}
else
{
uni
.
reLaunch
({
url
:
'../login/authorized'
...
...
@@ -208,7 +202,7 @@
</
script
>
<
style
lang=
"scss"
scoped
>
.
canvas
{
.
viewport-wrapper
{
position
:
relative
;
height
:
100%
;
user-select
:
none
;
...
...
@@ -217,9 +211,6 @@
background-size
:
cover
;
background-position
:
center
;
}
.viewport-wrapper
{
position
:
relative
;
}
.view-element
{
position
:
absolute
;
user-select
:
none
;
...
...
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