Skip to content

Commit

Permalink
update: ui
Browse files Browse the repository at this point in the history
  • Loading branch information
canwdev committed Dec 11, 2024
1 parent cf70dcc commit 7562f6a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {IPriceByDay} from '@/components/AppUtils/StockTracker/types'
// 定义 props
const props = defineProps<{
byDay: IPriceByDay
title: string
}>()
const {title} = toRefs(props)
// 创建 ref
const chartRef = ref<HTMLDivElement | null>(null)
let chartInstance: echarts.ECharts | null = null
Expand Down Expand Up @@ -59,7 +60,7 @@ const initChart = () => {
const option = {
title: [
{
text: 'K Line',
text: props.title,
left: 'center',
top: 10,
},
Expand Down Expand Up @@ -157,6 +158,10 @@ onMounted(() => {
initChart()
})
watch(title, () => {
initChart()
})
// 组件卸载时销毁
onUnmounted(() => {
if (chartInstance) {
Expand Down
5 changes: 3 additions & 2 deletions src/components/AppUtils/StockTracker/StockPrices.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import {IStockTrackerPrices} from '@/components/AppUtils/StockTracker/types'
import TabLayout from '@/components/CanUI/packages/Layouts/TabLayout.vue'
import EchartsKLine from '@/components/AppUtils/StockTracker/Graphs/EchartsKLine.vue'
import EchartsCandlestick from '@/components/AppUtils/StockTracker/Graphs/EchartsCandlestick.vue'
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -40,9 +40,10 @@ watch(
<div class="stock-prices-wrapper">
<TabLayout v-model="curTab" :options="tabOptions" horizontal>
<template v-if="stockPrices[curTab]">
<EchartsKLine
<EchartsCandlestick
v-if="stockPrices[curTab] && stockPrices[curTab].byDay"
:by-day="stockPrices[curTab]!.byDay"
:title="curTab"
/>
</template>
</TabLayout>
Expand Down
1 change: 0 additions & 1 deletion src/components/QuickLaunch/use-common-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export const useCommonTools = () => {
search: 'settings',
props: {
onClick: async () => {
mainStore.isShowQuickLaunch = false
mainStore.isShowSettings = true
},
},
Expand Down

0 comments on commit 7562f6a

Please # to comment.