You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
944 B
43 lines
944 B
import { useQuasar } from 'quasar';
|
|
|
|
/**
|
|
* Use this when using Vue 3 composition api (setup)
|
|
*/
|
|
export default function () {
|
|
const $q = useQuasar();
|
|
|
|
function showNotification (message, type = 'success') {
|
|
let color = 'primary';
|
|
let icon = 'info';
|
|
|
|
switch (type) {
|
|
case 'info':
|
|
break;
|
|
case 'success':
|
|
color = 'green';
|
|
break;
|
|
case 'error':
|
|
case 'danger':
|
|
color = 'red';
|
|
break;
|
|
case 'warning':
|
|
color = 'yellow';
|
|
break;
|
|
|
|
}
|
|
if ('danger' === type) {
|
|
type = 'error';
|
|
}
|
|
|
|
$q.notify({
|
|
position: 'top',
|
|
timeout: 10000,
|
|
message: message,
|
|
color: color,
|
|
html: true,
|
|
multiLine: true,
|
|
});
|
|
}
|
|
|
|
return {showNotification};
|
|
}
|
|
|