blessing-skin-server/resources/assets/src/shims.d.ts
2019-05-08 11:41:49 +08:00

62 lines
1.2 KiB
TypeScript

/* eslint-disable camelcase */
import Vue from 'vue'
import * as JQuery from 'jquery'
type I18n = 'en' | 'zh_CN'
declare global {
let blessing: {
base_url: string
debug: boolean
env: string
fallback_locale: I18n
locale: I18n
site_name: string
timezone: string
version: string
route: string
extra: any
i18n: object
ui: object
fetch: {
get(url: string, params?: object): Promise<object>
post(url: string, data?: object): Promise<object>
}
event: {
on(eventName: string, listener: Function): void
emit(eventName: string, payload: object): void
}
notify: {
showModal(
message: string,
title?: string,
type?: string,
options?: Partial<{ btnText: string, callback: string, destroyOnClose: boolean }>
)
}
}
}
declare module 'vue/types/vue' {
interface Vue {
$t(key: string, parameters?: object): string
$http: {
get(url: string, params?: object)
post(url: string, data?: object): { code?: number, message?: string }
}
$route: RegExpExecArray | null
}
}
interface ModalOptions {
btnText?: string,
callback?: CallableFunction,
destroyOnClose?: boolean
}