update translation docs (#1993)

* Translate how-it-works.md via GitLocalize

* Translate router.md via GitLocalize

* Translate project-setup.md via GitLocalize

* Translate roadmap.md via GitLocalize

Co-authored-by: sansx <646924078@qq.com>
This commit is contained in:
gitlocalize-app[bot] 2021-08-09 14:24:00 +02:00 committed by GitHub
parent 8bf59dec0e
commit e474533daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 144 deletions

View File

@ -16,7 +16,7 @@ description: 有关框架的底层细节
请注意,在查看扩展的宏代码时,您可能会遇到异常冗长的代码。因为生成的代码有时可能会与应用程序中的其他代码冲突。为了防止出现问题,请保持`proc_macro` 的“卫生”。以下是一些示例:
1. 使用`::yew::<module>` 而不是 `yew::<module>` 来保证对Yew包的正确引用。这也是为什么呼吁使用`::alloc::vec::Vec::new()`来代替`Vec::new()`调用。
2. 由于潜在的trait方法名称冲突使用`<Type as Trait>`来确保我们使用的是正确的trait。
2. 为了避免潜在的trait方法名称冲突使用`<Type as Trait>`来确保我们使用的是正确的trait。
## 什么是虚拟DOM
@ -36,4 +36,4 @@ Yew 的虚拟 DOM 与浏览器 DOM 并不是完全对应的。它还包括用于
- [从 Rust Book 中了解更多宏的信息](https://doc.rust-lang.org/stable/book/ch19-06-macros.html)
- [更多有关`cargo-expand`的信息](https://github.com/dtolnay/cargo-expand)
- [`yew::virtual_dom`的 API 文档](https://docs.rs/yew/*/yew/virtual_dom/index.html)
- [在API文档中查看`yew::virtual_dom`](https://docs.rs/yew/*/yew/virtual_dom/index.html)

View File

@ -83,4 +83,4 @@ Switch trait 适用于比字符串更结构化的捕获组。你可以指定实
## 相关例子
- [Router](https://github.com/yewstack/yew/tree/master/examples/router)
- [Router](https://github.com/yewstack/yew/tree/v0.18/examples/router)

View File

@ -1,138 +1,52 @@
---
title: 项目设置
sidebar_label: 介绍
description: 为成功做好准备
---
# 项目设置
## Rust
首先 ,你需要安装 Rust 。如何安装 Rust 和 `cargo` 构建工具,请参考[官方说明](https://www.rust-lang.org/tools/install)。
此外,为了将 Rust 编译为 Wasm您还需要安装`wasm32-unknown-unknown`。如果你使用的是 rustup只需运行`rustup target add wasm32-unknown-unknown`
:::important Yew 支持的最低 Rust 版本 (MSRV) 是`1.49.0` 。旧版本可能会导致意外问题,并伴有难以理解的错误消息。你可以使用 `rustup show` 在“active toolchain”下`rustc --version`检查您的工具链版本。要更新您的工具链,请运行`rustup update` 。 :::
## **Wasm 构建工具**
需要安装额外的工具以方便 WebAssembly 与 JavaScript 间的相互操作。此外,根据你选择的工具,他们可以生成所有必需的 JavaScript 包装代码来让你的应用程序中的 `.wasm` 文件运行在浏览器中,从而帮助减轻部署和打包的麻烦。
### [**`trunk`**](https://github.com/thedodd/trunk/)
一个实际是为了构建 Yew 应用程序的而制作的工具。它可以构建任何基于`wasm-bindgen`的应用程序,其设计灵感来自 rollup.js。使用 Trunk您无需安装 Node.js 或接触任何 JavaScript 代码。它可以将资源assets绑定到的你的应用程序甚至附带 Sass 编译器。
我们所有的示例都基于Trunk构建。
[开始使用 `trunk`](project-setup/using-trunk.md)
### [**`wasm-pack`**](https://rustwasm.github.io/docs/wasm-pack/)
一个由 Rust / Wasm 工作组开发的用于打包 WebAssembly 的 CLI 工具。与 Webpack 的 [`wasm-pack-plugin`](https://github.com/wasm-tool/wasm-pack-plugin) 插件搭配使用最佳。
由 Rust / Wasm 工作组开发的用于打包 WebAssembly 的 CLI 工具。最好与[`wasm-pack-plugin`](https://github.com/wasm-tool/wasm-pack-plugin)一起使用。 `wasm-pack`的主要目的是构建用于 JavaScript 的 Wasm 库。因此,它只能构建库,不提供开发服务器或自动重建等有用工具
[开始使用 wasm-pack](project-setup/using-wasm-pack.md)
### [**`wasm-bindgen`**](https://rustwasm.github.io/docs/wasm-bindgen/)
同时是一个库和一个 CLI 工具,也是由 Rust / Wasm 工作组开发。它是一个促进 JS 和 WebAssembly 之间互操作性的底层工具(在 `wasm-pack` 内部被用到)。我们不建议直接使用 `wasm-bindgen` 因为它需要手写一些 JavaScript 代码来引导你的 WebAssembly 二进制程序。但是,直接使用它也是可能的并且可以在 [**`wasm-bindgen` 指南**](https://rustwasm.github.io/docs/wasm-bindgen/) 上找到更多信息。
[开始使用 wasm-bindgen](project-setup/using-wasm-bindgen.md)
[开始使用 `wasm-pack`](project-setup/using-wasm-pack.md)
### [**`cargo-web`**](https://github.com/koute/cargo-web)
`wasm-pack``wasm-bindgen` 被介绍前的首选 web 工作流工具。它仍然是**最快捷**的启动和运行方式,值得安装以运行尚未迁移到支持 `wasm-pack` 的示例程序
`wasm-bindgen`创造之前,可以称之为首选的最佳工具。
[开始使用 cargo-web](project-setup/using-cargo-web.md)
[开始使用 `cargo web`](project-setup/using-cargo-web.md)
### 对比
<table>
<thead>
<tr>
<th style={{ textAlign: "left" }}></th>
<th style={{ textAlign: "left" }}><code>wasm-pack</code>
</th>
<th style={{ textAlign: "left" }}><code>wasm-bindgen</code>
</th>
<th style={{ textAlign: "left" }}><code>cargo-web</code>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style={{ textAlign: "left" }}>&#x9879;&#x76EE;&#x72B6;&#x6001;</td>
<td style={{ textAlign: "left" }}>&#x7531; <a href="https://rustwasm.github.io/">Rust / Wasm &#x5DE5;&#x4F5C;&#x7EC4;</a>&#x79EF;&#x6781;&#x7EF4;&#x62A4;</td>
<td
style={{ textAlign: "left" }}>&#x7531; <a href="https://rustwasm.github.io/">Rust / Wasm &#x5DE5;&#x4F5C;&#x7EC4;</a>&#x79EF;&#x6781;&#x7EF4;&#x62A4;</td>
<td
style={{ textAlign: "left" }}>&#x8D85;&#x8FC7;&#x516D;&#x4E2A;&#x6708;&#x6CA1;&#x6709; Github &#x6D3B;&#x52A8;</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}>&#x5F00;&#x53D1;&#x4F53;&#x9A8C;</td>
<td style={{ textAlign: "left" }}>&#x63A5;&#x8FD1;&#x5B8C;&#x7F8E;&#xFF01;&#x9700;&#x8981; <code>webpack</code> &#x4EE5;&#x83B7;&#x5F97;&#x6700;&#x4F73;&#x4F53;&#x9A8C;&#x3002;</td>
<td
style={{ textAlign: "left" }}>&#x6BD4;&#x8F83;&#x57FA;&#x7840;&#x3002;&#x4F60;&#x9700;&#x8981;&#x7F16;&#x5199;&#x4E00;&#x4E9B;&#x811A;&#x672C;&#x6765;&#x7B80;&#x5316;&#x4F60;&#x7684;&#x5F00;&#x53D1;&#x4F53;&#x9A8C;&#x3002;</td>
<td
style={{ textAlign: "left" }}>&#x7BA1;&#x7528;&#xFF01;&#x81EA;&#x5E26;&#x201C;&#x7535;&#x6C60;&#x201D;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x5916;&#x90E8;&#x4F9D;&#x8D56;&#x3002;</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}>&#x672C;&#x5730;&#x670D;&#x52A1;&#x5668;</td>
<td style={{ textAlign: "left" }}>&#x901A;&#x8FC7; <code>webpack</code> &#x63D2;&#x4EF6;&#x652F;&#x6301;</td>
<td
style={{ textAlign: "left" }}>&#x4E0D;&#x652F;&#x6301;</td>
<td style={{ textAlign: "left" }}>&#x652F;&#x6301;</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}>&#x6839;&#x636E;&#x672C;&#x5730;&#x66F4;&#x6539;&#x81EA;&#x52A8;&#x91CD;&#x65B0;&#x6784;&#x5EFA;</td>
<td
style={{ textAlign: "left" }}>&#x901A;&#x8FC7; <code>webpack</code> &#x63D2;&#x4EF6;&#x652F;&#x6301;</td>
<td
style={{ textAlign: "left" }}>&#x4E0D;&#x652F;&#x6301;</td>
<td style={{ textAlign: "left" }}>&#x652F;&#x6301;</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}>&#x65E0;&#x5934;&#x6D4F;&#x89C8;&#x5668;&#x6D4B;&#x8BD5;</td>
<td style={{ textAlign: "left" }}><a href="https://rustwasm.github.io/docs/wasm-pack/commands/test.html">&#x652F;&#x6301;</a>
</td>
<td style={{ textAlign: "left" }}><a href="https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/index.html">&#x652F;&#x6301;</a>
</td>
<td style={{ textAlign: "left" }}><a href="https://github.com/koute/cargo-web#features">&#x652F;&#x6301;</a>
</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}>&#x652F;&#x6301;&#x751F;&#x6210;&#x7684;&#x76EE;&#x6807;&#x4EE3;&#x7801;</td>
<td
style={{ textAlign: "left" }}>
<ul>
<li><code>wasm32-unknown-unknown</code>
</li>
</ul>
</td>
<td style={{ textAlign: "left" }}>
<ul>
<li><code>wasm32-unknown-unknown</code>
</li>
</ul>
</td>
<td style={{ textAlign: "left" }}>
<ul>
<li><code>wasm32-unknown-unknown</code>
</li>
<li><code>wasm32-unknown-emscripten</code>
</li>
<li><code>asmjs-unknown-emscripten</code>
</li>
</ul>
</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}><code>web-sys</code>
</td>
<td style={{ textAlign: "left" }}>&#x517C;&#x5BB9;</td>
<td style={{ textAlign: "left" }}>&#x517C;&#x5BB9;</td>
<td style={{ textAlign: "left" }}>&#x4E0D;&#x517C;&#x5BB9;</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}><code>stdweb</code>
</td>
<td style={{ textAlign: "left" }}>&#x517C;&#x5BB9;</td>
<td style={{ textAlign: "left" }}>&#x517C;&#x5BB9;</td>
<td style={{ textAlign: "left" }}>&#x517C;&#x5BB9;</td>
</tr>
<tr>
<td style={{ textAlign: "left" }}>&#x793A;&#x4F8B;&#x7528;&#x6CD5;</td>
<td style={{ textAlign: "left" }}><a href="https://github.com/yewstack/yew-wasm-pack-minimal">&#x65B0;&#x624B;&#x6A21;&#x677F;</a>
</td>
<td style={{ textAlign: "left" }}>Yew &#x793A;&#x4F8B;&#x7A0B;&#x5E8F;&#x7684;<a href="https://github.com/yewstack/yew/blob/master/examples/build_all.sh">&#x6784;&#x5EFA;&#x811A;&#x672C;</a>
</td>
<td style={{ textAlign: "left" }}>Yew &#x793A;&#x4F8B;&#x7A0B;&#x5E8F;&#x7684;<a href="https://github.com/yewstack/yew/blob/master/examples/build_all.sh">&#x6784;&#x5EFA;&#x811A;&#x672C;</a>
</td>
</tr>
</tbody>
</table>
| `trunk` | `wasm-pack` | `cargo-web`
--- | --- | --- | ---
项目状态 | 积极维护 | [由 Rust / Wasm 工作组](https://rustwasm.github.io)积极维护 | 超过 6 个月没有 Github 活动
开发体验 | 开箱即用!无需任何外部依赖。 | 比较基础。你需要编写一些脚本来简化你的开发体验或者使用webpack插件版本。 | 适用于代码层面,但需要单独的资产通道。
本地服务器 | 支持 | 仅限webpack插件版本 | 支持
根据本地更改自动重新构建 | 支持 | 仅限webpack插件版本 | 支持
资源处理 | 支持 | 仅限webpack插件版本 | 仅限静态资源
无头浏览器测试 | [开发中](https://github.com/thedodd/trunk/issues/20) | [支持](https://rustwasm.github.io/wasm-pack/book/commands/test.html) | [支持](https://github.com/koute/cargo-web#features)
支持生成的目标代码 | <ul><li><code>wasm32-unknown-unknown</code></li></ul> | <ul><li><code>wasm32-unknown-unknown</code></li></ul> | <ul> <li><code>wasm32-unknown-unknown</code></li> <li><code>wasm32-unknown-emscripten</code></li> <li><code>asmjs-unknown-emscripten</code></li> </ul>
`web-sys` | 兼容 | 兼容 | 不兼容
`stdweb` | 不兼容 | 兼容 | 兼容
示例用法 | <a href="https://github.com/yewstack/yew-wasm-pack-minimal">简单的示例</a> | [新手模板](https://github.com/yewstack/yew-wasm-pack-minimal) | `yew-stdweb` 示例程序的[构建脚本](https://www.github.com/yewstack/yew/tree/master/packages/yew-stdweb/examples)

View File

@ -1,40 +1,41 @@
---
title: 路线图
description: Yew 框架规划功能的路线图
---
# 路线图
## 优先次序
## `v1.0.0`
由社区决定将来特性的开发优先度以及需要侧重的关注点。 在2020年春季发起过开发者调查问卷收集有关项目发展方向的反馈。您可以在[Yew Wiki](https://github.com/yewstack/yew/wiki/Dev-Survey-%5BSpring-2020%5D)中找到摘要。
### 规划中的功能
:::note 所有主要计划都可以在 Yew Github[项目板](https://github.com/yewstack/yew/projects) 中查看进展 :::
* 标记 key 的列表项:[https://github.com/yewstack/yew/issues/479](https://github.com/yewstack/yew/issues/479)
* 路由:[https://github.com/yewstack/yew\_router](https://github.com/yewstack/yew_router)
## 关注点
### 生产环境准备
1. 高优先级的功能
2. 生产环境预备
3. 文档
4. 痛点
* 浏览器兼容性
* 提高 Yew 框架的测试覆盖率
* 增加性能基准测试:[https://github.com/yewstack/yew/issues/5](https://github.com/yewstack/yew/issues/5)
### 高优先级的功能
### 指南
1. [函数式组件](https://github.com/yewstack/yew/projects/3)
2. [组件库](https://github.com/yewstack/yew/projects/4)
3. 更好的状态管理
4. [服务端渲染](https://github.com/yewstack/yew/projects/5)
* 最佳实践:[https://yew.rs/optimizations](https://yew.rs/optimizations)
* 端到端教程
* Futures / 并发
* CSS / 样式
* 测试
* 状态管理
### 为了在生产环境使用还需解决的需求
## 未来
- 提高 Yew 框架的测试覆盖率
- 缩减二进制文件的大小
- [基准表现](https://github.com/yewstack/yew/issues/5)
### 潜在功能
### 文档
* 服务端渲染:[https://github.com/yewstack/yew/issues/41](https://github.com/yewstack/yew/issues/41)
* 组件库:[https://github.com/yewstrap/yewstrap](https://github.com/yewstrap/yewstrap)
* 代码分割:[https://github.com/yewstack/yew/issues/599](https://github.com/yewstack/yew/issues/599)
* 允许不同的虚拟 DOM 后端:[https://github.com/yewstack/yew/issues/482](https://github.com/yewstack/yew/issues/482)
* 反思 Services[https://github.com/yewstack/yew/issues/364](https://github.com/yewstack/yew/issues/364)
* 成熟的工具包:[https://github.com/yewstack/yewtil](https://github.com/yewstack/yewtil)
* HTML 模板备选方案:[https://github.com/yewstack/yew/issues/438](https://github.com/yewstack/yew/issues/438)
- 创建教程
- 简化项目设置
### 痛点
- [组件样板](https://github.com/yewstack/yew/issues/830)
- Fetch API
- [代理Agents](https://github.com/yewstack/yew/projects/6)