mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] Toast: add onClose prop (#2964)
This commit is contained in:
@@ -8,6 +8,7 @@ const defaultOptions = {
|
||||
value: true,
|
||||
message: '',
|
||||
className: '',
|
||||
onClose: null,
|
||||
duration: 3000,
|
||||
position: 'middle',
|
||||
forbidClick: false,
|
||||
@@ -52,6 +53,10 @@ function Toast(options = {}) {
|
||||
clear() {
|
||||
toast.value = false;
|
||||
|
||||
if (options.onClose) {
|
||||
options.onClose();
|
||||
}
|
||||
|
||||
if (!singleton && !isServer) {
|
||||
clearTimeout(toast.timer);
|
||||
queue = queue.filter(item => item !== toast);
|
||||
|
Reference in New Issue
Block a user