mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-18 21:21:21 +08:00
doc: update docs/tauri.md (#618) 21ddcb51cb
This commit is contained in:
@ -39,7 +39,7 @@
|
||||
<p>这个 <a href="https://tauri.app/">tauri</a> 快速参考备忘单显示了它的常用命令使用清单</p>
|
||||
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
|
||||
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
|
||||
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#快速开始">快速开始</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#依赖环境">依赖环境</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#启动-tauri-开发窗口">启动 Tauri 开发窗口</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#检测最新版本的-tauri">检测最新版本的 Tauri</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#更新-npm-包">更新 npm 包</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#更新-cargo-包">更新 Cargo 包</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#应用程序调试">应用程序调试</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#以编程方式打开-devtools">以编程方式打开 Devtools</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#在生产中使用检查器">在生产中使用检查器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#启用开发工具功能">启用开发工具功能</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#配置">配置</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#配置结构">配置结构</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#tauri-配置">Tauri 配置</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#cliconfig">CliConfig</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#package-配置">Package 配置</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#windowconfig">WindowConfig</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#patternkind">PatternKind</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#棕地模式">棕地模式</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#隔离模式建议出于安全目的">隔离模式。建议出于安全目的</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#windowurl">WindowUrl</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#systemtrayconfig">SystemTrayConfig</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
|
||||
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#快速开始">快速开始</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#依赖环境">依赖环境</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#启动-tauri-开发窗口">启动 Tauri 开发窗口</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#检测最新版本的-tauri">检测最新版本的 Tauri</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#更新-npm-包">更新 npm 包</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#更新-cargo-包">更新 Cargo 包</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#应用程序调试">应用程序调试</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#以编程方式打开-devtools">以编程方式打开 Devtools</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#在生产中使用检查器">在生产中使用检查器</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#启用开发工具功能">启用开发工具功能</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#安卓开发">安卓开发</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#环境变量">环境变量</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#准备目标">准备目标</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#编译">编译</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#签名">签名</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#配置">配置</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#配置结构">配置结构</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#tauri-配置">Tauri 配置</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#cliconfig">CliConfig</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#package-配置">Package 配置</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#windowconfig">WindowConfig</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#patternkind">PatternKind</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#棕地模式">棕地模式</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#隔离模式建议出于安全目的">隔离模式。建议出于安全目的</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#windowurl">WindowUrl</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#systemtrayconfig">SystemTrayConfig</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-exist row-span-3"><div class="wrap-header h3wrap"><h3 id="快速开始"><a aria-hidden="true" tabindex="-1" href="#快速开始"><span class="icon icon-link"></span></a>快速开始</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=row-span-3-->
|
||||
<p>Bash</p>
|
||||
@ -80,7 +80,11 @@
|
||||
|
||||
|
||||
|
||||
<table><thead><tr><th align="left">软件</th><th align="left">描述</th></tr></thead><tbody><tr><td align="left"><a href="https://www.rust-lang.org/tools/install">rust</a></td><td align="left">rust安装</td></tr><tr><td align="left"><a href="https://nodejs.org/en">nodejs</a></td><td align="left">nodejs安装</td></tr><tr><td align="left"><a href="https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/">Build Tools</a></td><td align="left">Microsoft C++ 生成工具 (for windows)</td></tr></tbody></table>
|
||||
|
||||
|
||||
|
||||
|
||||
<table><thead><tr><th align="left">软件</th><th align="left">描述</th></tr></thead><tbody><tr><td align="left"><a href="https://www.rust-lang.org/tools/install">rust</a></td><td align="left">rust安装</td></tr><tr><td align="left"><a href="https://nodejs.org/en">nodejs</a></td><td align="left">nodejs安装</td></tr><tr><td align="left"><a href="https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/">Windows Build Tools</a></td><td align="left">Microsoft C++ 生成工具 (for windows)</td></tr><tr><td align="left"><a href="https://developer.android.google.cn/studio?hl=zh-cn">Android Studio</a></td><td align="left">安卓开发工具</td></tr></tbody></table>
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="启动-tauri-开发窗口"><a aria-hidden="true" tabindex="-1" href="#启动-tauri-开发窗口"><span class="icon icon-link"></span></a>启动 Tauri 开发窗口</h3><div class="wrap-body">
|
||||
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ <span class="token function">npm</span> run tauri dev
|
||||
</span><span class="code-line">$ <span class="token function">yarn</span> tauri dev
|
||||
@ -152,6 +156,33 @@
|
||||
</span><span class="code-line"><span class="token key attr-name">tauri</span> <span class="token punctuation">=</span> <span class="token value attr-value">{ version = "...", features = ["...", "devtools"] }</span>
|
||||
</span></code></pre>
|
||||
<p>在文件 <code>src-tauri/Cargo.toml</code> 中启用 <code>devtools Cargo</code> 功能</p>
|
||||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="安卓开发"><a aria-hidden="true" tabindex="-1" href="#安卓开发"><span class="icon icon-link"></span></a>安卓开发</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="环境变量"><a aria-hidden="true" tabindex="-1" href="#环境变量"><span class="icon icon-link"></span></a>环境变量</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
<p><code>JAVA_HOME</code></p>
|
||||
<p><code>ANDROID_HOME</code></p>
|
||||
<p><code>NDK_HOME</code></p>
|
||||
</div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="准备目标"><a aria-hidden="true" tabindex="-1" href="#准备目标"><span class="icon icon-link"></span></a>准备目标</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ <span class="token function">npm</span> <span class="token function">install</span> @tauri-apps/cli@next @tauri-apps/api@next
|
||||
</span><span class="code-line">$ <span class="token function">npm</span> run tauri migrate
|
||||
</span><span class="code-line">$ rustup target <span class="token function">add</span> aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
|
||||
</span><span class="code-line">$ <span class="token function">rm</span> <span class="token parameter variable">-r</span> src-tauri/gen
|
||||
</span><span class="code-line">$ <span class="token function">npm</span> run tauri android init
|
||||
</span><span class="code-line">$ <span class="token function">npm</span> run tauri icon
|
||||
</span></code></pre>
|
||||
<p>修改应用名:%app_path%\src-tauri\gen\android\app\src\main\res\values\strings.xml</p>
|
||||
</div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="编译"><a aria-hidden="true" tabindex="-1" href="#编译"><span class="icon icon-link"></span></a>编译</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ <span class="token function">npm</span> run tauri android dev
|
||||
</span><span class="code-line">$ <span class="token function">npm</span> run tauri android build
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="签名"><a aria-hidden="true" tabindex="-1" href="#签名"><span class="icon icon-link"></span></a>签名</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ keytool <span class="token parameter variable">-genkey</span> <span class="token parameter variable">-alias</span> android.keystore <span class="token parameter variable">-keyalg</span> RSA <span class="token parameter variable">-validity</span> <span class="token number">20000</span> <span class="token parameter variable">-keystore</span> android.keystore
|
||||
</span><span class="code-line">$ zipalign <span class="token parameter variable">-p</span> <span class="token parameter variable">-f</span> <span class="token parameter variable">-v</span> <span class="token number">4</span> unsigned.apk release.apk
|
||||
</span><span class="code-line">$ apksigner sign <span class="token parameter variable">--ks</span> android.keystore release.apk
|
||||
</span></code></pre>
|
||||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="配置"><a aria-hidden="true" tabindex="-1" href="#配置"><span class="icon icon-link"></span></a>配置</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="配置结构"><a aria-hidden="true" tabindex="-1" href="#配置结构"><span class="icon icon-link"></span></a>配置结构</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
|
Reference in New Issue
Block a user