CMD模式
require("test.js");
a();//可以直接使用
小程序报错
WAService.js:1 thirdScriptError setMaxDigits is not defined;at "pages/index/index"
page onRequest function ReferenceError: a is not defined
test.js
function a(){
.......
}
function b(){
.......
}
目前是在微信小程序使用第三方的test.js,在之前的H5项目是可以使用test.js的?目前就是不想去用exports和module.exports改变test.js。
需要加上从当前页面到该文件的完整路由 如:../../common/test.js -----当前页面位置的前一个前一个文件夹的common文件夹的test.js 文件
var test = require("test.js");
test.a();
test.js 中
module.exports = {a:a}