feat(web): 前端全局重构专业量化后台(深色+红涨绿跌+设计系统)
- 设计系统 styles/tokens.css: 深色token(#0d1117底/#161b22卡片) + 红涨绿跌 (--up#f85149/--down#3fb950) + 品牌蓝#1890ff + 间距/圆角/阴影/mono - Element Plus深色(element-dark.css + dark/css-vars)+reset - 删Vite脚手架残留(style.css重写/HelloWorld/hero/vite/vue资源) - Layout重构(深色专业侧边)+Login+图表统一深色(useChart/echartsDark) - 新建paper/Live.vue实走监控(step状态/净值/持仓/今日信号10s轮询) - 业务页套.page头, 保留所有功能/路由/api - 验证: vue-tsc --noEmit ✅ + npm run build ✅
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/* ECharts 生命周期复用:init / setOption / resize / dispose 统一 */
|
||||
import { onMounted, onUnmounted, type Ref } from 'vue'
|
||||
import * as echarts from 'echarts'
|
||||
|
||||
export function useChart(el: Ref<HTMLDivElement | undefined>) {
|
||||
let chart: echarts.ECharts | null = null
|
||||
|
||||
function setOption(option: echarts.EChartsCoreOption): void {
|
||||
chart?.setOption(option, true)
|
||||
}
|
||||
|
||||
function resize(): void {
|
||||
chart?.resize()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (el.value) chart = echarts.init(el.value)
|
||||
window.addEventListener('resize', resize)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', resize)
|
||||
chart?.dispose()
|
||||
chart = null
|
||||
})
|
||||
|
||||
return { setOption }
|
||||
}
|
||||
Reference in New Issue
Block a user