【发布时间】:2022-10-22 11:46:39
【问题描述】:
我正在尝试更新 yew 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>
</>
}
}
我想知道如何在不出错的情况下完成这项工作。
我正在使用中继服务,其中没有显示任何错误,但是当我使用此特定代码时,它自身的页面不会加载。
【问题讨论】:
-
你是什么意思“这没用”?您是否收到编译器错误?请包括他们。还是您遇到运行时错误?还是输出不正确?也包括该信息。
-
我只使用中继服务。所以没有编译器错误,而是页面没有加载。
标签: rust frontend webassembly yew