Skip to main content
Version: 0.18.0

新手模板

trunk#

  • 最简模板 - 通过Trunk构建的小型应用程序,可以帮助快速您入门。

wasm-pack#

与其他工具不同, wasm-pack强制您使用lib而不是bin crate,并且程序的入口需要用#[wasm_bindgen(start)]属性进行标注。

你的 Cargo.toml 同样应该指明你的工程的 crate 类型是 "cdylib" 。

[package]name = "yew-app"version = "0.1.0"authors = ["Yew App Developer <name@example.com>"]edition = "2018"
[lib]# You should include "rlib" (the default crate type) otherwise your crate can't be used as a Rust library# which, among other things, breaks unit testingcrate-type = ["rlib", "cdylib"]
[dependencies]# for web_sysyew = "0.17"# or for stdweb# yew = { version = "0.17", package = "yew-stdweb" }wasm-bindgen = "0.2"

其他模板#