What's wrong with this way of writing? Why is it different from writing then (function (RS) {} when RS cannot be found??
let vm = new Vue({
el: '#wrap',
data: {
rs: ''
},
methods: {
getData(type, url, dataObject, okcallback, ercallback) {
if (String(type).toLowerCase() == 'get' && dataObject) {
axios.get(url, {
params: dataObject
}).then(okcallback)
.catch(ercallback)
} else if (!dataObject) {
axios.get(url).then(okcallback)
.catch(ercallback)
} else {
axios.post(url, qs.stringfy(dataObject)).then(okcallback).catch(ercallback)
}
},
resultSuccess(rs) {
console.log('aaa');
// vm.rs = rs;
// console.log(vm.rs, rs);
},
resultError(err) {
}
},
mounted() {
console.log('mounted over');
this.getData('GET', url,'', this.resultSuccess, this.resultError);
},
})
getData(type, url, dataObject, okcallback, ercallback)
this.getData('GET', url, this.resultSuccess, this.resultError);
DataObject? Is the parameter in the wrong position