微信小程序引入绝对路径
方法1app.js
page.js
App({
require: function($uri){return require($uri)},
onLaunch: function () {
},
)}
方法2app.json
const app = getApp();
const echarts = app.require('/ec-canvas/echarts')
Page({
data:{
},
onLoad: function (options) {
},
)}
index.js
{
"resolveAlias":{
"~/*": "/*"
},
"pages": [
"pages/index/index"
],
}
【转自:响水网站建设 http://www.1234xp.com/xiangshui.html 复制请保留原URL】
import * as echarts from '~/ec-canvas/echarts';
Page({
data:{
},
onLoad: function (options) {
},
)}