<template> <div class="box"> <div id="container" /> </div> </template> <script> import { option2 } from '@/views/zhangqiu/js/data' import Charts from '@jiaminghi/charts' export default { name: 'Chart', data() { return { data: option2 } }, mounted() { this.chart() }, methods: { chart() { const container = document.getElementById('container') const myChart = new Charts(container) myChart.setOption(this.data) } } } </script> <style> #container { /*width: 350px;*/ height: 200px; /* background: #f1f1f1; */ } </style>