- Electron 主进程:窗口管理、IPC、项目读写、打包引擎 - Vue 3 前端:4 个视图页面、3 个组件、Pinia 状态管理 - 生成应用模板:Express 后端 + Electron 窗口 - 支持资源导入、应用配置、跨平台打包
204 lines
4.8 KiB
Vue
204 lines
4.8 KiB
Vue
<template>
|
||
<div class="help-page">
|
||
<header class="help-header">
|
||
<button class="btn btn-secondary btn-sm" @click="goHome">← 返回</button>
|
||
<h2>使用帮助</h2>
|
||
</header>
|
||
|
||
<div class="help-content">
|
||
<section class="help-section">
|
||
<h3>什么是 Web2App?</h3>
|
||
<p>Web2App 是一个桌面工具,可以将完整的网站(包括前端和后端)打包成独立的桌面应用程序。用户只需导入网站资源文件,配置应用信息,即可一键生成安装包。</p>
|
||
</section>
|
||
|
||
<section class="help-section">
|
||
<h3>使用步骤</h3>
|
||
<div class="step-list">
|
||
<div class="step">
|
||
<span class="step-num">1</span>
|
||
<div>
|
||
<strong>新建项目</strong>
|
||
<p>在首页点击"新建项目",选择项目保存位置并输入项目名称。</p>
|
||
</div>
|
||
</div>
|
||
<div class="step">
|
||
<span class="step-num">2</span>
|
||
<div>
|
||
<strong>导入资源</strong>
|
||
<p>在项目编辑页,点击"导入文件夹"或"导入文件"按钮,选择网站的资源文件。支持 HTML、JS、CSS、图片等各类文件。</p>
|
||
</div>
|
||
</div>
|
||
<div class="step">
|
||
<span class="step-num">3</span>
|
||
<div>
|
||
<strong>配置应用</strong>
|
||
<p>填写应用名称、版本号、窗口尺寸等信息。可选择应用图标。</p>
|
||
</div>
|
||
</div>
|
||
<div class="step">
|
||
<span class="step-num">4</span>
|
||
<div>
|
||
<strong>打包生成</strong>
|
||
<p>点击"打包应用",选择输出位置,开始打包。生成独立的安装包文件。</p>
|
||
</div>
|
||
</div>
|
||
<div class="step">
|
||
<span class="step-num">5</span>
|
||
<div>
|
||
<strong>安装运行</strong>
|
||
<p>在目标计算机上运行生成的安装包,按照向导完成安装。启动应用即可使用。</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="help-section">
|
||
<h3>后端支持</h3>
|
||
<p>如果你的网站包含后端,请在导入时包含 <code>server.js</code> 文件。Web2App 会在生成的应用中自动启动后端服务。</p>
|
||
<p>后端 server.js 示例:</p>
|
||
<pre><code>module.exports = function(app) {
|
||
app.get('/api/hello', (req, res) => {
|
||
res.json({ message: 'Hello from Web2App!' })
|
||
})
|
||
}</code></pre>
|
||
</section>
|
||
|
||
<section class="help-section">
|
||
<h3>注意事项</h3>
|
||
<ul>
|
||
<li>首次打包需要下载依赖,请保持网络畅通</li>
|
||
<li>生成的安装包体积约 50-80MB(含 Electron 运行时)</li>
|
||
<li>支持 Windows、macOS、Linux 平台</li>
|
||
<li>确保网站入口文件名为 index.html</li>
|
||
</ul>
|
||
</section>
|
||
|
||
<section class="help-section">
|
||
<h3>版本信息</h3>
|
||
<p>Web2App v1.0.0</p>
|
||
<p>Electron + Vue 3</p>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { useRouter } from 'vue-router'
|
||
|
||
const router = useRouter()
|
||
function goHome() {
|
||
router.push('/')
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.help-page {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.help-header {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
padding: 12px 20px;
|
||
background: var(--surface);
|
||
border-bottom: 1px solid var(--border);
|
||
}
|
||
|
||
.help-header h2 {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.help-content {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
padding: 24px;
|
||
max-width: 700px;
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.help-section {
|
||
margin-bottom: 28px;
|
||
}
|
||
|
||
.help-section h3 {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
margin-bottom: 12px;
|
||
color: var(--text);
|
||
}
|
||
|
||
.help-section p {
|
||
color: var(--text-secondary);
|
||
margin-bottom: 8px;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.help-section code {
|
||
background: var(--primary-light);
|
||
padding: 2px 6px;
|
||
border-radius: 4px;
|
||
font-size: 13px;
|
||
color: var(--primary);
|
||
}
|
||
|
||
.help-section pre {
|
||
background: #1e293b;
|
||
color: #e2e8f0;
|
||
padding: 16px;
|
||
border-radius: var(--radius);
|
||
overflow-x: auto;
|
||
margin: 12px 0;
|
||
font-size: 13px;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
.help-section ul {
|
||
list-style: disc;
|
||
padding-left: 20px;
|
||
color: var(--text-secondary);
|
||
}
|
||
|
||
.help-section li {
|
||
margin-bottom: 6px;
|
||
}
|
||
|
||
.step-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
}
|
||
|
||
.step {
|
||
display: flex;
|
||
gap: 12px;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
.step-num {
|
||
width: 28px;
|
||
height: 28px;
|
||
border-radius: 50%;
|
||
background: var(--primary);
|
||
color: white;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.step strong {
|
||
display: block;
|
||
margin-bottom: 4px;
|
||
}
|
||
|
||
.step p {
|
||
font-size: 13px;
|
||
}
|
||
</style>
|