Commit 9e7f2148 authored by leon's avatar leon

fix: index page localstorage

parent c01bde6b
......@@ -132,6 +132,9 @@
},
methods: {
initChart() {
if(!this.elementData.dataList) {
return
}
this.tabsValue = this.elementInfo.option.tabs.defaultValue
if (this.elementData.dataList.defaultValue) {
this.tabsValue = this.elementData.dataList.defaultValue
......@@ -267,6 +270,8 @@
align-items: flex-start;
flex-wrap: wrap;
width: 100%;
justify-content: center;
align-items: center;
}
.tab-vertical {
display: flex !important;
......@@ -277,7 +282,7 @@
.tab-item {
width: var(--width);
margin: 1%;
margin: 3px;
font-size: var(--font-size);
color: var(--color);
border: var(--border-style);
......
......@@ -213,8 +213,8 @@ export default {
}
},
'elementData.dataList': {
handler(newVal) {
if (newVal) {
handler(newVal,oldVal) {
if (JSON.stringify(newVal) !== JSON.stringify(oldVal) ) {
this.setStorageData()
this.initChart()
}
......
......@@ -72,6 +72,11 @@
const toolbox = {show: false}
this.element.option.toolbox = toolbox
},
onUnload() {
// 移除监听事件
uni.$off('handleLinkParams')
uni.$off('handleLinkComp')
},
onShow() {
/**
* 组件交互 - 组件
......
......@@ -124,9 +124,9 @@
// detail页面也会监听这两个事件,所有index页面需要在onShow里面增加监听,在onHide里面移除监听
onShow() {
const that = this
// if(uni.getStorageSync('reportInfo')) {
// this.reportInfo = JSON.parse(uni.getStorageSync('reportInfo'))
// }
if(Object.keys(that.reportInfo).length) {
uni.setStorageSync('reportInfo', JSON.stringify(that.reportInfo))
}
/**
* 组件交互 - 参数
*/
......@@ -267,7 +267,7 @@
}
that.reportInfo = this.handleTabsLink(res.data.Result)
uni.setStorageSync('reportInfo', JSON.stringify(res.data.Result))
uni.setStorageSync('reportInfo', JSON.stringify(that.reportInfo))
that.getStickyTables()
}
},
......
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