You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
cloudnote_web/plugins/global.js

29 lines
734 B

import Vue from 'vue'
Vue.prototype.GLOBAL ={
//用户cookie
user_key:'user',
//服务器地址
server_address:'http://127.0.0.1:8080',
// 检查元素可见
visible_in_container:function(p,e) {
var z = p.getBoundingClientRect();
var r = e.getBoundingClientRect();
// Check style visiblilty and off-limits
return !(r.top > z.bottom || r.bottom < z.top ||
r.left > z.right || r.right < z.left);
},
postJSON(url,form,success){
fetch(this.server_address + url, {
body:JSON.stringify(form),
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
}).then(res=>res.json()).then(res=>success(res)).catch(err=>{
console.error(err)
})
}
}