x2rr / funds

自选基金助手是一款Chrome扩展,用来快速获取关注基金的实时数据,查看自选基金的实时估值情况
https://x2rr.github.io/funds/docs/dist/index.html
GNU General Public License v3.0
2.23k stars 279 forks source link

执行 npm run watch:dev 调试报错 提示 echarts 对象找不到 #213

Open xuyh1024 opened 1 year ago

xuyh1024 commented 1 year ago

企业微信截图_16718644361870

分析原因是因为 以UMD引入 customed.js 时 找不到this 对象

    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['exports', 'echarts'], factory);
    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
        // CommonJS
        factory(exports, require('echarts'));
    } else {
        // Browser globals
        factory({}, root.echarts);
    }

root.echarts 改为 Window.echarts 可解决