如何为 Vue Toastify 添加持续时间
How to add duration to Vue Toastify
我正在为我的项目使用 Vue Toastify,一切正常,只是它不会自动消失。我已经添加了 successDuration
和 errorDuration
但它仍然停留在屏幕上,除非我点击它。这是我试过的,
Vue.use(VueToastify,{
position:"top-right",
canTimeout:false,
errorDuration:500,
successDuration:500,
alertInfoDuration:500,
duration:500,
});
我猜你错过了。您必须输入 canTimeout: true
,而不是 false
,然后您可以根据 type
指定持续时间,您已使用 successDuration
和 errorDuration
] 已经。
Vue.use(VueToastify,{
position:"top-right",
canTimeout:true,
errorDuration:500,
successDuration:500,
alertInfoDuration:500,
duration:500,
});
编辑:您也可以省略 canTimeout
参数,因为默认情况下它是 true
这里是包作者。
根据上述评论, canTimeout
应设置为 true 或直接忽略。
也没有 duration
这样的全局设置。那只能在状态对象上设置
我正在为我的项目使用 Vue Toastify,一切正常,只是它不会自动消失。我已经添加了 successDuration
和 errorDuration
但它仍然停留在屏幕上,除非我点击它。这是我试过的,
Vue.use(VueToastify,{
position:"top-right",
canTimeout:false,
errorDuration:500,
successDuration:500,
alertInfoDuration:500,
duration:500,
});
我猜你错过了。您必须输入 canTimeout: true
,而不是 false
,然后您可以根据 type
指定持续时间,您已使用 successDuration
和 errorDuration
] 已经。
Vue.use(VueToastify,{
position:"top-right",
canTimeout:true,
errorDuration:500,
successDuration:500,
alertInfoDuration:500,
duration:500,
});
编辑:您也可以省略 canTimeout
参数,因为默认情况下它是 true
这里是包作者。
根据上述评论, canTimeout
应设置为 true 或直接忽略。
也没有 duration
这样的全局设置。那只能在状态对象上设置