본문 바로가기
개발 지식 B+/에러 해결 모음

nuxt project에서 import

by ddubbu 2021. 3. 30.
728x90
반응형

nuxt project에서 import 계속 안되길래 전전긍긍했다.

 

// Getting warnings for `export 'default' (imported as 'mod') was not found`
// package.json 에서 확인한 버전
"echarts": "^5.0.2",
"vue-echarts": "^6.0.0-alpha.5"

 

그래서 nuxt.config 파일을 고쳐보았는데 그래도 안되고... 무슨 일이지 싶었다. 헌데 import 방식을 아래처럼 하니깐 되었다 ㅜㅜ

 

<template>
  <div id="main" style="width: 600px; height: 400px"></div>
</template>

<script>
import * as echarts from "echarts";
// import { init } from "echarts";
export default {
  mounted() {
    // based on prepared DOM, initialize echarts instance
    var myChart = echarts.init(document.getElementById("main"));

    // specify chart configuration item and data
    var option = {
      // chart 옵션 정의하고 
    };

    // use configuration item and data specified to show chart
    myChart.setOption(option);
  },
};
</script>

<style lang="scss" scoped>
</style>

 

반응형