自动更新年份在紫杉Wasm Rust



我正在尝试更新红豆杉wasm (rust)的版权年份。这是下面的代码,我正在尝试,但不幸的是,它不工作。

use yew::prelude::*;
use chrono::prelude::*;
#[function_component(Footer)]
pub fn footer() -> Html
{
let current_date = chrono::Utc::now().date();
html! 
{
<>
<div class={ "static bottom-0 bg-[#fff] opacity-90 container mx-auto max-w-3xl py-8" }> 
<footer>
<div class={ "flex justify-center space-x-4" }>
<h1>{ format!("Copyright {} Name. All Rights Reserved.", current_date.year()) }</h1>
</div>
</footer>
</div>
</>
}
}

我想知道如何使这个工作而不出现错误。

我正在使用trunk服务,其中不显示任何错误,但当我使用此特定代码时,页面本身不加载。

你的帖子显示了完整的程序吗?如果没有,你能寄出去吗?

同时,尝试替换下面的行:

{ format!("Copyright {} Name. All Rights Reserved.", current_date.year()) }
"Copyright {current_date.year()} Name. All Rights Reserved."

最新更新