notification.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. /** Whether to show a close button */
  22. showClose: boolean
  23. /** Whether message is treated as HTML string */
  24. dangerouslyUseHTMLString?: boolean
  25. /** Callback function when closed */
  26. onClose: () => void
  27. /** Callback function when notification clicked */
  28. onClick: () => void
  29. /** Offset from the top edge of the screen. Every Notification instance of the same moment should have the same offset */
  30. offset: number
  31. }
  32. export interface ElNotification {
  33. /** Show a notification */
  34. (options: ElNotificationOptions): ElNotificationComponent
  35. /** Show a success notification */
  36. success (message: string | VNode): ElNotificationComponent
  37. /** Show a success notification */
  38. success (options: ElNotificationOptions): ElNotificationComponent
  39. /** Show a warning notification */
  40. warning (message: string | VNode): ElNotificationComponent
  41. /** Show a warning notification */
  42. warning (options: ElNotificationOptions): ElNotificationComponent
  43. /** Show an info notification */
  44. info (message: string | VNode): ElNotificationComponent
  45. /** Show an info notification */
  46. info (options: ElNotificationOptions): ElNotificationComponent
  47. /** Show an error notification */
  48. error (message: string | VNode): ElNotificationComponent
  49. /** Show an error notification */
  50. error (options: ElNotificationOptions): ElNotificationComponent
  51. }
  52. declare module 'vue/types/vue' {
  53. interface Vue {
  54. /** Displays a global notification message at the upper right corner of the page */
  55. $notify: ElNotification
  56. }
  57. }