0

我尝试按照https://dev.to/arctic_hen7/how-to-set-up-tailwind-css-with-yew-and-trunk-il9中描述的步骤在 Yew 中使用 Tailwind CSS,但是它不起作用。

我的测试项目文件夹:

在此处输入图像描述

货物.toml:

[package]
name = "yew-tailwind-app"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
yew = { version = "0.19" }

索引.html:

<!DOCTYPE html>
<html lang="en">
    <head>
        <link data-trunk href="./tailwind.css" rel="css" />
    </head>

    <body>
    </body>
</html>

main.rs 中的代码:

use yew::prelude::*;

#[function_component(App)]
fn app() -> Html {
    html! {
        <>
            <h1>{ "Hello World" }</h1>
            <p class={ classes!("bg-red-500") }>{"Test!"}</p>
        </>
    }
}

fn main() {
    yew::start_app::<App>();
}

但我在“测试!”中看不到红色背景颜色。你能帮我吗?

在此处输入图像描述

4

0 回答 0