customApiForMessage.js 813 Bytes
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
//自定义函数...













export default {
	//在此函数中添加发送通讯前的方法(参数为:通讯对象)
	customMethodsForExecBefore(messageObj) {
		//执行自定义方法...
		//messageObj.headers.append('Content-Type','application/json;charset=utf-8');

		if (window.GLOBAL_CACHE && window.GLOBAL_CACHE.PAGEID_CACHE) {
			const key = "CUR-PAGE-IDS";
			let pageIds = [...window.GLOBAL_CACHE.PAGEID_CACHE].join(",");
			messageObj.headers.append(key, pageIds);
		}

	},

	//在此函数中添加通讯完成后的回调方法(参数分别为:响应体,返回的数据,通讯对象,返回的错误信息)
	customMethodsForCallback(response, responseData, messageObj, error) {
		//执行自定义方法...
		//return true/false;true执行通讯回调函数,false,不执行

	}
}