67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
import { writeFileSync } from 'fs'
|
|
|
|
const L = {
|
|
intraday: '\u5206\u65f6',
|
|
day: '\u65e5K',
|
|
week: '\u5468K',
|
|
month: '\u6708K',
|
|
avg: '\u5747\u4ef7',
|
|
volume: '\u6210\u4ea4\u91cf',
|
|
}
|
|
|
|
const content = `<template>
|
|
<div class="chart-panel card" v-loading="klineLoading">
|
|
<el-tabs v-model="period" class="tabs" @tab-change="onTabChange">
|
|
<el-tab-pane :label="L.intraday" name="intraday" />
|
|
<el-tab-pane :label="L.day" name="day" />
|
|
<el-tab-pane :label="L.week" name="week" />
|
|
<el-tab-pane :label="L.month" name="month" />
|
|
</el-tabs>
|
|
<v-chart class="chart" :option="option" autoresize />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, ref } from 'vue'
|
|
import { use } from 'echarts/core'
|
|
import { CanvasRenderer } from 'echarts/renderers'
|
|
import { LineChart, BarChart, CandlestickChart } from 'echarts/charts'
|
|
import {
|
|
GridComponent,
|
|
TooltipComponent,
|
|
DataZoomComponent,
|
|
LegendComponent,
|
|
} from 'echarts/components'
|
|
import type { EChartsOption } from 'echarts'
|
|
import VChart from 'vue-echarts'
|
|
import type { Candle, QuoteData } from '../../types'
|
|
import type { KlinePeriod } from '../../composables/useQuote'
|
|
|
|
use([
|
|
CanvasRenderer,
|
|
LineChart,
|
|
BarChart,
|
|
CandlestickChart,
|
|
GridComponent,
|
|
TooltipComponent,
|
|
DataZoomComponent,
|
|
LegendComponent,
|
|
])
|
|
|
|
/** Tab / series labels — keep as JS unicode to avoid file encoding corruption */
|
|
const L = {
|
|
intraday: '\\u5206\\u65f6',
|
|
day: '\\u65e5K',
|
|
week: '\\u5468K',
|
|
month: '\\u6708K',
|
|
avg: '\\u5747\\u4ef7',
|
|
volume: '\\u6210\\u4ea4\\u91cf',
|
|
}
|
|
|
|
// Fix: the above would be literal backslash-u. Write real chars via template:
|
|
void 0
|
|
</script>
|
|
`
|
|
writeFileSync('src/components/quote/ChartPanel.vue', 'placeholder')
|
|
console.log('skip')
|