Commit fc407217 authored by Jenny's avatar Jenny

feat: 减少页面dom层级

parent 66f3b11f
<template> <template>
<view <view class="viewport-wrapper" :style="[styleObject]">
class="canvas"
:style="[styleObject]"
>
<view class="viewport-wrapper" :style="{
width: `${reportInfo.width * scale}px`,
height: `${reportInfo.height * scale}px`
}">
<template v-for="(element, index) in reportData"> <template v-for="(element, index) in reportData">
<view <view
class="view-element" class="view-element"
...@@ -60,7 +53,6 @@ ...@@ -60,7 +53,6 @@
</view> </view>
</template> </template>
</view> </view>
</view>
</template> </template>
<script> <script>
...@@ -75,9 +67,11 @@ ...@@ -75,9 +67,11 @@
computed: { computed: {
styleObject() { styleObject() {
let params = {} let params = {}
const { backgroundColor, backgroundImage } = this.reportInfo const { backgroundColor, backgroundImage, width, height } = this.reportInfo
if(backgroundImage) params = { 'background-image': `url(${backgroundImage})` } if(backgroundImage) params = { 'background-image': `url(${backgroundImage})` }
return { return {
width: `${width * this.scale}px`,
height: `${height * this.scale}px`,
'background-color': backgroundColor, 'background-color': backgroundColor,
...params ...params
} }
...@@ -90,7 +84,6 @@ ...@@ -90,7 +84,6 @@
}, },
onLoad() { onLoad() {
this.userAuthCheck() this.userAuthCheck()
this.getReportCharts()
/** /**
* 组件交互 - 参数 * 组件交互 - 参数
*/ */
...@@ -111,6 +104,7 @@ ...@@ -111,6 +104,7 @@
onUnload() { onUnload() {
// 移除监听事件 // 移除监听事件
uni.$off('handleLinkParams') uni.$off('handleLinkParams')
uni.$off('handleLinkComp')
clearInterval(this.timename) clearInterval(this.timename)
}, },
methods: { methods: {
...@@ -121,7 +115,7 @@ ...@@ -121,7 +115,7 @@
var authorized = uni.getStorageSync('authorized') var authorized = uni.getStorageSync('authorized')
if (userId) { if (userId) {
if (authorized) { if (authorized) {
this.getReportCharts()
} else { } else {
uni.reLaunch({ uni.reLaunch({
url:'../login/authorized' url:'../login/authorized'
...@@ -208,7 +202,7 @@ ...@@ -208,7 +202,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.canvas { .viewport-wrapper {
position: relative; position: relative;
height: 100%; height: 100%;
user-select: none; user-select: none;
...@@ -217,9 +211,6 @@ ...@@ -217,9 +211,6 @@
background-size: cover; background-size: cover;
background-position: center; background-position: center;
} }
.viewport-wrapper {
position: relative;
}
.view-element { .view-element {
position: absolute; position: absolute;
user-select: none; user-select: none;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment