我直接在html中引用了 从axios cdn上下载来的js文件 并在js文件尾部加入如下代码
var uuid, bmid, url;
bmid = 2//这里写部门id
url = 'http://192.168.1.106:1024/kffp'//分配服务器地址
uuid = localStorage.getItem("uuid");
console.log(typeof uuid);
if (typeof (uuid) == 'undefined' || typeof (uuid) == 'null' || typeof (uuid) == '' || uuid == null) {
localStorage.setItem("uuid", randomString());
this.uuid = localStorage.getItem("uuid");
}
axios.post(this.url, {
uuid: this.uuid,
bmid: this.bmid
})
.then(function (response) {
console.log(response.data);
alert(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
然后访问html页面这段代码执行没问题,后来我把这段代码用 functio