在 hbuilderX的菜单“视图”中选择“显示终端”,在终端中把当前目录定位到uni-app的根目录,这样才可以把crypto-js库安装在正确的位置,在终端中键入:npm install crypto-js ,等待片刻,crypto-js 库就装在了uni-app的根目录的:/node_modules/crypto-js/* 中了.要使用其相关加解密算法,只要在代码中引入:import cj from '../../../node_modules/crypto-js/crypto-js.js
如下 定义了一个外部js文件,其中有一个function import lunaCommon from '../lunaCommon.js'; var ctx = wx.getStorageSync("ctx"); var filter = "/ms-code"; var apis = { //根据sc获取发货单 "findDispatchBill": function (data, success) { var url = ctx + filt
function include(path){ var a=document.createElement("script"); a.type = "text/javascript"; a.src=path; var head=document.getElementsByTagName("head")[0]; head.appendChild(a); } 可以在任何地方以include(&q