fix build errors
This commit is contained in:
parent
2c1190d8fb
commit
b045a1b978
@ -37,7 +37,7 @@ governor = { version = "0.8", optional = true }
|
|||||||
md-5 = { version = "0.10", optional = true }
|
md-5 = { version = "0.10", optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
web-sys = { version = "0.3", features = ["Document", "Window", "Storage", "Element", "DomTokenList", "MediaQueryList", "HtmlImageElement", "MouseEvent", "KeyboardEvent", "Node", "EventTarget", "Navigator"] }
|
web-sys = { version = "0.3", features = ["Document", "Window", "Storage", "Element", "HtmlElement", "DomTokenList", "MediaQueryList", "HtmlImageElement", "MouseEvent", "KeyboardEvent", "Node", "EventTarget", "Navigator"] }
|
||||||
wasm-bindgen = "0.2"
|
wasm-bindgen = "0.2"
|
||||||
wasm-bindgen-futures = "0.4"
|
wasm-bindgen-futures = "0.4"
|
||||||
js-sys = "0.3"
|
js-sys = "0.3"
|
||||||
|
|||||||
@ -31,6 +31,8 @@ pub fn ImageViewer(
|
|||||||
// 打开灯箱时聚焦关闭按钮,并监听 Escape 键关闭。
|
// 打开灯箱时聚焦关闭按钮,并监听 Escape 键关闭。
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
{
|
{
|
||||||
|
use wasm_bindgen::{closure::Closure, JsCast};
|
||||||
|
|
||||||
use_effect(move || {
|
use_effect(move || {
|
||||||
if !is_open() {
|
if !is_open() {
|
||||||
return;
|
return;
|
||||||
@ -43,6 +45,7 @@ pub fn ImageViewer(
|
|||||||
.and_then(|w| w.document())
|
.and_then(|w| w.document())
|
||||||
.and_then(|d| d.query_selector(".image-viewer-close").ok())
|
.and_then(|d| d.query_selector(".image-viewer-close").ok())
|
||||||
.flatten()
|
.flatten()
|
||||||
|
.and_then(|e| e.dyn_into::<web_sys::HtmlElement>().ok())
|
||||||
{
|
{
|
||||||
let _ = btn.focus();
|
let _ = btn.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,6 @@ mod db;
|
|||||||
#[cfg(feature = "server")]
|
#[cfg(feature = "server")]
|
||||||
mod highlight;
|
mod highlight;
|
||||||
mod hooks;
|
mod hooks;
|
||||||
#[cfg(feature = "server")]
|
|
||||||
mod models;
|
mod models;
|
||||||
mod pages;
|
mod pages;
|
||||||
mod router;
|
mod router;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user