mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-07 01:46:48 +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 class="home-bottom-container">
|
||||
<lineEcharts
|
||||
:key="options.title"
|
||||
:key="options.title.text"
|
||||
:options="options"
|
||||
style="width: 100%;height: 100%;background: unset"
|
||||
></lineEcharts>
|
||||
@@ -146,6 +146,18 @@ export default {
|
||||
components: {
|
||||
lineEcharts
|
||||
},
|
||||
watch: {
|
||||
'sidebar.opened': function(val) {
|
||||
this.options.title.text = null
|
||||
setTimeout(() => {
|
||||
if (this.datasetList.length > 0) {
|
||||
this.getEcharts()
|
||||
} else {
|
||||
this.getKnowledgeList()
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {
|
||||
let userInfo = sessionStorage.getItem('userInfo')
|
||||
@@ -154,6 +166,16 @@ export default {
|
||||
}
|
||||
this.getKnowledgeList()
|
||||
this.getAgentList()
|
||||
window.addEventListener('resize', () => {
|
||||
this.options.title.text = null
|
||||
setTimeout(() => {
|
||||
if (this.datasetList.length > 0) {
|
||||
this.getEcharts()
|
||||
} else {
|
||||
this.getKnowledgeList()
|
||||
}
|
||||
}, 300)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getEcharts() {
|
||||
@@ -277,7 +299,7 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['name', 'sidebarLogo'])
|
||||
...mapGetters(['sidebar', 'sidebarList'])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user