index.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <div class="app-chart">
  3. <Tabs class="app-tabs--info" :data-list="dataList" @change="changePeriod" />
  4. <MLine v-bind="{ symbol, goodsCode, makretId }" v-if="cycleType === ChartCycleType.Time" />
  5. <KLine v-bind="{ symbol, goodsCode, cycleType }" v-else />
  6. </div>
  7. </template>
  8. <script lang="ts" setup>
  9. import { shallowRef } from 'vue'
  10. import { ChartCycleType, getChartCycleTypeList } from '@/constants/chart'
  11. import Tabs from '@/components/base/tabs/index.vue'
  12. import KLine from './candlestick/index.vue'
  13. import MLine from './timeline/index.vue'
  14. defineProps({
  15. goodsCode: {
  16. type: String,
  17. required: true
  18. },
  19. makretId: Number
  20. })
  21. const symbol = '000000.et' // https://blog.csdn.net/jones2000/article/details/104457569
  22. const cycleType = shallowRef(ChartCycleType.Time) // 图表周期类型
  23. const dataList = getChartCycleTypeList()
  24. // 切换周期
  25. const changePeriod = (index: number) => {
  26. cycleType.value = dataList[index].value
  27. }
  28. </script>
  29. <style lang="less">
  30. @import './index.less';
  31. </style>