1.0.8 • Published 5 years ago
@hoksi/vuecmd v1.0.8
window.$ = require("@hoksi/vuecmd/ajax.js");
import Cmd from "@hoksi/vuecmd";
var mainloadingcount = 0;
var loading = null;
Vue.use(Cmd, {
testing:true, //show console.log
url: "../api/",
data: {
"key":"value"
},
before: function () {
//this is vue instance
mainloadingcount += 1;
setTimeout(() => {
if (mainloadingcount && !loading) loading = this.$loading();
}, 500);
},
after: function () {
//this is vue instance
mainloadingcount -= 1;
setTimeout(() => {
if (!mainloadingcount && loading) {
loading.close();
loading = null;
}
}, 1);
}
});
this.$cmdoptions.data["usertoken"]="";
this.$cmd
.setdata({
action: "path/to/action"
})
.post(function(err, result) {
});
overrideurl(url) //reset url completely
seturl(url) //append url to root url
cleardata()
adddata(key,value)
deletedata(key)
setdata(data) //append data
post(callback)
get(callback)
import getusertoken from "@hoksi/vuecmd/getusertoken";
var usertoken = getusertoken();