notification.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import Vue, { VNode } from 'vue'
  2. import { MessageType } from './message'
  3. /** Notification Component */
  4. export declare class ElNotificationComponent extends Vue {
  5. /** Close the Notification instance */
  6. close ()
  7. }
  8. export interface ElNotificationOptions {
  9. /** Title */
  10. title: string
  11. /** Description text */
  12. message: string | VNode
  13. /** Notification type */
  14. type: MessageType
  15. /** Custom icon's class. It will be overridden by type */
  16. iconClass: string
  17. /** Custom class name for Notification */
  18. customClass: string
  19. /** Duration before close. It will not automatically close if set 0 */
  20. duration: number
  21. /** Callback function when closed */
  22. onClose: () => void
  23. /** Offset from the top edge of the screen. Every Notification instance of the same moment should have the same offset */
  24. offset: number
  25. }
  26. export interface ElNotification {
  27. /** Show a notification */
  28. (options: ElNotificationOptions): ElNotificationComponent
  29. /** Show a success notification */
  30. success (message: string | VNode): ElNotificationComponent
  31. /** Show a success notification */
  32. success (options: ElNotificationOptions): ElNotificationComponent
  33. /** Show a warning notification */
  34. warning (message: string | VNode): ElNotificationComponent
  35. /** Show a warning notification */
  36. warning (options: ElNotificationOptions): ElNotificationComponent
  37. /** Show an info notification */
  38. info (message: string | VNode): ElNotificationComponent
  39. /** Show an info notification */
  40. info (options: ElNotificationOptions): ElNotificationComponent
  41. /** Show an error notification */
  42. error (message: string | VNode): ElNotificationComponent
  43. /** Show an error notification */
  44. error (options: ElNotificationOptions): ElNotificationComponent
  45. }
  46. declare module 'vue/types/vue' {
  47. interface Vue {
  48. /** Displays a global notification message at the upper right corner of the page */
  49. $notify: ElNotification
  50. }
  51. }