12345678910111213141516171819202122232425262728293031323334353637383940 |
- <script setup>
- import {watch,onMounted} from 'vue'
- import {apiChartInfoByCode} from '@/api/chart.js'
- import {chartRender} from './utils/render'
- const props=defineProps({
- code:{
- type:String,
- default:''
- },
- renderId:{//渲染到的dom id
- type:String,
- default:''
- }
- })
- onMounted(()=>{
- getChartInfo()
- })
- // 获取图表详情
- async function getChartInfo(){
- const res=await apiChartInfoByCode({UniqueCode:props.code})
- if(res.Ret===200){
- chartRender(res.Data,props.renderId)
- }
- }
- </script>
- <template>
- <div class="chart-box" :id="renderId"></div>
- </template>
- <style lang="scss" scoped>
- .chart-box{
- width: 100%;
- height: 100%;
- }
- </style>
|