@codelet/core
Version:
mini core
19 lines (18 loc) • 523 B
JavaScript
import { isObject, isString } from '@daysnap/utils';
import { definePlugin, promisify } from '../../utils';
/**
* loading 的时候默认开启 mask
*/
function showLoading(options = 'loading') {
if (isString(options)) {
options = { title: options, mask: true };
}
else if (isObject(options)) {
options = { mask: true, ...options };
}
return promisify(wx.showLoading)(options);
}
export const showLoadingPlugin = definePlugin((col) => {
;
col['showLoading'] = showLoading;
});