F-loat / mpvue-echarts

📈 适用于 mpvue 的 echarts 组件
337 stars 91 forks source link

自定义构建 ECharts导入后运行出错。 #7

Closed novasq closed 6 years ago

novasq commented 6 years ago
import * as echarts from '../../echarts.min.js'
import mpvueEcharts from 'mpvue-echarts'

. . . 错误信息: thirdScriptError this.echarts.setCanvasCreator is not a function;at pages/one/main page lifeCycleMethod onReady function TypeError: this.echarts.setCanvasCreator is not a function

F-loat commented 6 years ago

官方这个精简版的我用着没问题 http://echarts.baidu.com/dist/echarts.simple.min.js ,你是用了自定义构建的吗

novasq commented 6 years ago

是的,我用官方的在线自定义构建封装了仪表盘,导入运行就出错。

F-loat commented 6 years ago

试了下仪表盘也没问题的啊,你用的 mpvue-echarts 是最新版的不

F-loat commented 6 years ago

我下的这个 http://echarts.baidu.com/builder/echarts.html?charts=gauge&components=title,legendScroll&api=true&version=4&versionCode=4.0.4

novasq commented 6 years ago

mpvue-echarts "version": "0.2.2"

F-loat commented 6 years ago

你参考下 https://github.com/F-loat/mpvue-echarts/blob/example/src/pages/demos/gauge.vue

novasq commented 6 years ago

好的,非常感谢!

markzhan commented 6 years ago

http://echarts.baidu.com/download.html 下载精简版

"dependencies": { "echarts": "^4.0.4", "mpvue": "^1.0.10", "mpvue-echarts": "^0.2.2", "vuex": "^2.3.1" },

import * as echarts from '@/libs/echarts.simple.min' import mpvueEcharts from 'mpvue-echarts'

同样出错: thirdScriptError this.echarts.setCanvasCreator is not a function;at pages/result/main page lifeCycleMethod onReady function TypeError: this.echarts.setCanvasCreator is not a function

F-loat commented 6 years ago

反馈时请附上下载链接,另外最好对比下和下面这个的差异 http://echarts.baidu.com/builder/echarts.html?charts=gauge&components=title,legendScroll&api=true&version=4&versionCode=4.0.4

markzhan commented 6 years ago

参考example:mpvue-echarts/build/webpack.base.conf.js 修改 build\webpack.base.conf.js test: /.js$/, include: [resolve('src'), resolve('test')], 新增: exclude: [resolve('src/libs')],