mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-11 03:46:50 +08:00
fix(app): 修复 Home 页面图表不能正确渲染的问题
- 更新 lineEcharts 组件的 key 属性,使用 options.title.text 替代 options.title - 添加监听 sidebar.opened 变化的 watch 函数,重新渲染图表 - 在 mounted钩子中添加窗口大小变化的事件监听,重新渲染图表- 更新 computed 属性,使用 sidebar 和 sidebarList 替代 sidebarLogo
This commit is contained in:
@@ -111,7 +111,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="home-bottom-container">
|
<div class="home-bottom-container">
|
||||||
<lineEcharts
|
<lineEcharts
|
||||||
:key="options.title"
|
:key="options.title.text"
|
||||||
:options="options"
|
:options="options"
|
||||||
style="width: 100%;height: 100%;background: unset"
|
style="width: 100%;height: 100%;background: unset"
|
||||||
></lineEcharts>
|
></lineEcharts>
|
||||||
@@ -146,6 +146,18 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
lineEcharts
|
lineEcharts
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
'sidebar.opened': function(val) {
|
||||||
|
this.options.title.text = null
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.datasetList.length > 0) {
|
||||||
|
this.getEcharts()
|
||||||
|
} else {
|
||||||
|
this.getKnowledgeList()
|
||||||
|
}
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {},
|
created() {},
|
||||||
mounted() {
|
mounted() {
|
||||||
let userInfo = sessionStorage.getItem('userInfo')
|
let userInfo = sessionStorage.getItem('userInfo')
|
||||||
@@ -154,6 +166,16 @@ export default {
|
|||||||
}
|
}
|
||||||
this.getKnowledgeList()
|
this.getKnowledgeList()
|
||||||
this.getAgentList()
|
this.getAgentList()
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
this.options.title.text = null
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.datasetList.length > 0) {
|
||||||
|
this.getEcharts()
|
||||||
|
} else {
|
||||||
|
this.getKnowledgeList()
|
||||||
|
}
|
||||||
|
}, 300)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getEcharts() {
|
getEcharts() {
|
||||||
@@ -277,7 +299,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['name', 'sidebarLogo'])
|
...mapGetters(['sidebar', 'sidebarList'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user