layui引入echarts模块
1、修改echarts.js文件(在文件开头)
修改为
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : window.layui && layui.define ? layui.define(function(exports){ exports('echarts',factory(exports))}) : (factory((global.echarts = {}))); }(this, (function (exports) { 'use strict';
2、配置引入
layui.config({ base: './febs/',//存放模块的目录 debug: true }).extend({ formSelects: 'lay/extends/formSelects-v4.min', treeSelect: 'lay/extends/treeSelect', apexcharts: 'lay/extends/apexcharts.min', eleTree: 'lay/extends/eleTree', echarts: 'lay/extends/echarts' })
然后就可以使用了
可以参考https://www.layui.com/doc/base/modules.html开发文档
参考https://fly.layui.com/jie/5080/ 讲的很详细