diff --git a/src/select/mod.rs b/src/select/mod.rs index 53477cf..8778e5c 100644 --- a/src/select/mod.rs +++ b/src/select/mod.rs @@ -1,9 +1,4 @@ -use crate::{ - teleport::Teleport, - theme::use_theme, - utils::{dom::window_event_listener, mount_style::mount_style}, - Theme, -}; +use crate::{teleport::Teleport, theme::use_theme, utils::mount_style::mount_style, Theme}; use leptos::*; use std::hash::Hash; use stylers::style_sheet_str; @@ -73,7 +68,7 @@ where } is_show_popover.set(false); }); - on_cleanup(timer); + on_cleanup(move || timer.remove()); let temp_options = options.clone(); let select_option_label = create_memo(move |_| match value.get() { diff --git a/src/slider/mod.rs b/src/slider/mod.rs index 783385b..1daa6c6 100644 --- a/src/slider/mod.rs +++ b/src/slider/mod.rs @@ -1,8 +1,4 @@ -use crate::{ - theme::use_theme, - utils::{dom::window_event_listener, mount_style::mount_style}, - Theme, -}; +use crate::{theme::use_theme, utils::mount_style::mount_style, Theme}; use leptos::*; use stylers::style_sheet_str; use wasm_bindgen::JsCast; @@ -47,7 +43,7 @@ pub fn Slider( let on_mouse_up = window_event_listener(ev::mouseup, move |_| { set_mouse_move.set(false); }); - on_cleanup(on_mouse_up); + on_cleanup(move || on_mouse_up.remove()); let on_mouse_move = window_event_listener(ev::mousemove, move |ev| { if is_mouse_move.get_untracked() { @@ -68,7 +64,7 @@ pub fn Slider( }; } }); - on_cleanup(on_mouse_move); + on_cleanup(move || on_mouse_move.remove()); view! { class=class_name,