zoukankan      html  css  js  c++  java
  • Ant design vue 引入echarts

              1、首先,在客户端输入:

       npm install echarts --save

             2、执行完毕后,再次编译运行

        yarn run serve

              可是结果没有想到,会报此错误:

    ERROR  Failed to compile with 6 errors                                                                                                            下午3:32:56
    These dependencies were not found:
    
    * ant-design-vue in ./src/core/use.js
    * ant-design-vue/dist/antd.less in ./src/core/use.js
    * ant-design-vue/es/icon in ./src/components/Menu/menu.js
    * ant-design-vue/es/locale/zh_CN in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
    * ant-design-vue/es/menu in ./src/components/Menu/menu.js
    * vue-router in ./src/router/index.js
    
    To install them, you can run: npm install --save ant-design-vue ant-design-vue/dist/antd.less ant-design-vue/es/icon ant-design-vue/es/locale/zh_CN ant-design-vue/es/menu vue-router

          3、再次安装

    yarn install

    warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
    [1/4] Resolving packages...
    success Already up-to-date.
    $ opencollective-postinstall
    Thank you for using vue-antd-pro!
    If you rely on this package, please consider supporting our open collective:
    > https://opencollective.com/ant-design-pro-vue/donate

    Done in 4.99s.

          4、再次编译运行   yarn run serve,  提示编译成功

          5、打开浏览器,访问后报JS错:

                echarts出现 “TypeError: Cannot read property ‘init‘ of undefined“报错

          6、在引入的地方把:

                  import echarts from 'echarts'

                更改为: import * as echarts from 'echarts'

           刷新后,就可以看到想要的柱状图了。

  • 相关阅读:
    angularJs实现星星等级评分
    angular自定义过滤器在页面和控制器中的使用
    字符串单个替换
    angular中的$cookies和$cookieStore设置过期时间
    DOM操作和jQuery实现选项移动操作
    PHP 中英文混排截取字符串
    固定格式时间转换时间戳
    PHP生成唯一订单号的方法汇总
    MySQL优化索引及优化汉字模糊查询语句
    简单封装数据库类
  • 原文地址:https://www.cnblogs.com/zhongjicainiao/p/14357109.html
Copyright © 2011-2022 走看看