- /**
- * 返回值或者Promise统一包装为返回promise
- * @param {*} result
- * @returns
- */
- export function resultJudge(result) {
- return new Promise((resolve) => {
- if (result && result.constructor == Promise) {
- result.then((resp) => {
- resolve(resp)
- })
- } else {
- resolve(result)
- }
- })
- }
|