diff --git a/src/components/api/Api.js b/src/components/api/Api.js index 755f5de1c..355321fe0 100644 --- a/src/components/api/Api.js +++ b/src/components/api/Api.js @@ -2,5 +2,6 @@ import FilterMatchMode from './FilterMatchMode'; import FilterOperator from './FilterOperator'; import FilterService from './FilterService'; import PrimeIcons from './PrimeIcons'; +import ToastSeverity from './ToastSeverity'; -export {FilterMatchMode,FilterOperator,FilterService,PrimeIcons}; \ No newline at end of file +export {FilterMatchMode,FilterOperator,FilterService,PrimeIcons,ToastSeverity}; \ No newline at end of file diff --git a/src/components/api/ToastSeverity.js b/src/components/api/ToastSeverity.js new file mode 100644 index 000000000..3fb8e93bc --- /dev/null +++ b/src/components/api/ToastSeverity.js @@ -0,0 +1,8 @@ +const ToastSeverities = { + INFO: 'info', + WARN: 'warn', + ERROR: 'error', + SUCCESS: 'success' +}; + +export default ToastSeverities; \ No newline at end of file diff --git a/src/views/toast/ToastDoc.vue b/src/views/toast/ToastDoc.vue index 2d79a98ff..8b46a0323 100755 --- a/src/views/toast/ToastDoc.vue +++ b/src/views/toast/ToastDoc.vue @@ -219,6 +219,21 @@ this.$toast.add({severity:'success', summary: 'Specific Message', group: 'mykey'

 <Toast :breakpoints="{'920px': {width: '100%', right: '0', left: '0'}}"></Toast>
 
+
+ +
Constants
+

ToastSeverity constants API is provided to easily choose a severity of the message with typescript.

+

+import {ToastSeverity} from 'primevue/api';
+
+export default {
+    methods: {
+        showInfo() {
+            this.$toast.add({severity: ToastSeverity.INFO, summary: 'Info Message', detail:'Message Content', life: 3000});
+        }
+    }
+}
+
 
Properties