方法1
app.js
App({
require: function($uri){return require($uri)},
onLaunch: function () {
},
)}
page.js
const app = getApp();
const echarts = app.require('/ec-canvas/echarts')
Page({
data:{
},
onLoad: function (options) {
},
)}
方法2
app.json
{
"resolveAlias":{
"~/*": "/*"
},
"pages": [
"pages/index/index"
],
}
index.js
import * as echarts from '~/ec-canvas/echarts';
Page({
data:{
},
onLoad: function (options) {
},
)}