get(url, data = {}, success = {}) {
axios({
url: url,
params: data,
method: 'GET',
headers: {
'X-SESSIONID': localStorage.sessionid
}
}).then(res => success(res.data)).catch(() => alert('网络请求失败'))
}
函数中传data = {}和success = {}
是什么意思啊;
`
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这是函数默认参数:
ES5中
ES2015中
ES2015
exploring es6
默认初始值为{},es6新特性,如果不给初试值为undefined,函数执行结果可能出现未预料的值。