feat: modal add close icon

This commit is contained in:
luoxiao 2023-04-12 21:15:38 +08:00
parent c51f220ed0
commit c43091de76
3 changed files with 4 additions and 2 deletions

View file

@ -17,6 +17,7 @@ leptos = { version = "0.2.4", features = ["stable"] }
stylers = "0.3.1" stylers = "0.3.1"
web-sys = "0.3.61" web-sys = "0.3.61"
leptos_dom = { version = "0.2.4" } leptos_dom = { version = "0.2.4" }
leptos-icons = { git = "https://github.com/Carlosted/leptos-icons.git", features = ["AiCloseOutlined"] }
[workspace] [workspace]
members = ["examples/basic"] members = ["examples/basic"]

View file

@ -11,7 +11,7 @@ pub fn DemoModal(cx: Scope) -> impl IntoView {
<Button on:click=move |_| set_open.update(move |value| *value = !*value)> <Button on:click=move |_| set_open.update(move |value| *value = !*value)>
"open modal" "open modal"
</Button> </Button>
<Modal title="" open=open on_cancel=on_cancel> <Modal title="标题" open=open on_cancel=on_cancel>
"sd" "sd"
</Modal> </Modal>
} }

View file

@ -3,6 +3,7 @@ use crate::teleport::*;
use crate::utils::mount_style::mount_style; use crate::utils::mount_style::mount_style;
use leptos::*; use leptos::*;
use stylers::style_sheet_str; use stylers::style_sheet_str;
use leptos_icons::*;
#[component] #[component]
pub fn Modal( pub fn Modal(
@ -30,7 +31,7 @@ pub fn Modal(
cx, cx,
<> <>
<span style="cursor: pointer;" on:click=move |_| if let Some(on_cancel) = &on_cancel { on_cancel.set(())}> <span style="cursor: pointer;" on:click=move |_| if let Some(on_cancel) = &on_cancel { on_cancel.set(())}>
{ "x" } <LeptosIcon icon=AiIcon::AiCloseOutlined/>
</span> </span>
</> </>
} }