mosha-vue-toastify
mosha-vue-toastify copied to clipboard
how to set default options
is there any api to set the default options, for example: set default duration to 10000ms.
hello, i tried manually this :
import 'mosha-vue-toastify/dist/style.css';
import { clearToasts } from "mosha-vue-toastify"
const toast = {
success: (message: string, duration: number = 3000) => {
createToast(message, {
hideProgressBar: false,
showIcon: true,
position: 'top-center',
type: 'success',
transition: 'bounce',
swipeClose: true,
timeout: duration
});
},
error: (message: string, duration: number = 3000) => {
createToast(message, {
hideProgressBar: false,
showIcon: true,
position: 'top-center',
type: 'danger',
transition: 'bounce',
swipeClose: true,
timeout: duration
});
},
warning: (message: string, duration: number = 3000) => {
createToast(message, {
hideProgressBar: false,
showIcon: true,
position: 'top-center',
type: 'warning',
transition: 'bounce',
swipeClose: true,
timeout: duration
});
},
info: (message: string, duration: number = 3000) => {
createToast(message, {
hideProgressBar: false,
showIcon: true,
position: 'top-center',
type: 'info',
transition: 'bounce',
swipeClose: true,
timeout: duration
});
},
loading: (message: string) => {
createToast(message, {
hideProgressBar: false,
showIcon: true,
position: 'top-center',
type: 'info',
transition: 'bounce',
timeout: -1,
});
},
clearAll: () => {
clearToasts()
}
}
export default toast;```
And maybe u can define default duration in props on Toast object