在紫杉的自动更新年份

发布于 2025-02-09 00:33:43 字数 833 浏览 3 评论 0原文

我正在尝试更新紫杉(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>
        </>
    }
}

我想知道如何在不遇到错误的情况下进行这项工作。

我正在使用中继线服务,其中没有显示任何错误,但是当我使用此特定代码时,它不会加载页面。

I am trying to update the copyright year in yew wasm (rust). This is the below code I am trying but it does not work unfortunately.

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>
        </>
    }
}

I was wondering how do I make this work without getting errors.

I am using trunk serve where in it does not show any errors but the page it self does not load when I use this specific code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

两人的回忆 2025-02-16 00:33:43

您的帖子显示完整程序吗?如果没有,您可以发布吗?

同时,尝试替换以下行:

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

使用此行:

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

Is your post showing the full program? If not, Can you post it?

In meantime, try to replace the below line:

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

with this line:

"Copyright {current_date.year()} Name. All Rights Reserved."
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文