chart.vue 476 B

12345678910111213141516171819202122232425262728
  1. <script setup>
  2. import { watch,ref,nextTick } from 'vue'
  3. import Highcharts from 'highcharts';
  4. const props = defineProps({
  5. id: {
  6. type: String
  7. },
  8. options: {
  9. type: Object
  10. }
  11. })
  12. const chart = ref(null)
  13. function initChart() {
  14. console.log('initchart')
  15. nextTick(() => {
  16. chart.value = Highcharts.chart(props.id,props.options)
  17. })
  18. }
  19. initChart()
  20. </script>
  21. <template>
  22. <div :id="id" class="chart-wrapper"></div>
  23. </template>
  24. <style scoped lang="scss">
  25. </style>