Expose internal function to global for plugins

This commit is contained in:
Pig Fang 2018-09-08 23:34:12 +08:00
parent e355c8df68
commit 87100e9ae7
3 changed files with 11 additions and 1 deletions

View File

@ -68,3 +68,5 @@ Vue.use(_Vue => {
post,
};
});
window.bsAjax = { get, post };

View File

@ -1,6 +1,6 @@
import $ from 'jquery';
import sweetalert2 from 'sweetalert2';
import 'toastr';
import toastr from 'toastr';
import { trans } from './i18n';
/**
@ -77,3 +77,7 @@ export const swal = sweetalert2.mixin({
confirmButtonText: trans('general.confirm'),
cancelButtonText: trans('general.cancel')
});
window.toastr = toastr;
window.showModal = showModal;
window.swal = swal;

View File

@ -18,6 +18,10 @@ interface Window {
bsEmitter: {
on(eventName: string, listener: Function): void
emit(eventName: string, payload: object): void
},
bsAjax: {
get(url: string, params?: object): Promise<object>
post(url: string, data?: object): Promise<object>
}
}