tui 项目初始化: vue-tui 技术栈骨架 (Vite 8 + Vue 3 + @vue-tui/runtime)
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
*.log
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "7z-encrypt-tui",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"description": "7z-encrypt 客户端 TUI (vue-tui: Vue 3 终端界面 + Python 管线)",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"check:type": "vue-tsc --noEmit",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "pnpm run build && node dist/main.mjs"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@vue-tui/runtime": "file:/home/lou/桌面/vue-tui/packages/runtime",
|
||||||
|
"vue": "^3.5.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.18.0",
|
||||||
|
"@vue-tui/vite": "file:/home/lou/桌面/vue-tui/packages/vite",
|
||||||
|
"typescript": "^6.0.3",
|
||||||
|
"unplugin-vue": "^7.2.0",
|
||||||
|
"vite": "8.2.1",
|
||||||
|
"vue-tsc": "^3.3.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { shallowRef } from "vue";
|
||||||
|
import { Box, Text, useInput } from "@vue-tui/runtime";
|
||||||
|
|
||||||
|
type View = "menu" | "upload" | "tasks" | "config";
|
||||||
|
const view = shallowRef<View>("menu");
|
||||||
|
|
||||||
|
useInput((input) => {
|
||||||
|
if (view.value !== "menu") {
|
||||||
|
if (input === "q" || input === "\u001b") view.value = "menu";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (input === "1") view.value = "upload";
|
||||||
|
else if (input === "2") view.value = "tasks";
|
||||||
|
else if (input === "3") view.value = "config";
|
||||||
|
else if (input === "q") process.exit(0);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Box flexDirection="column" :paddingX="1" :paddingY="1">
|
||||||
|
<Text bold color="cyan">7z-encrypt 客户端</Text>
|
||||||
|
<Text dimColor>安全文件传输 · 加密 / 分卷 / 上传</Text>
|
||||||
|
<Box height="1" />
|
||||||
|
<Text bold>主菜单</Text>
|
||||||
|
<Text> 1. 上传文件</Text>
|
||||||
|
<Text> 2. 任务续传</Text>
|
||||||
|
<Text> 3. 配置</Text>
|
||||||
|
<Text> q. 退出</Text>
|
||||||
|
<Box height="1" />
|
||||||
|
<Text dimColor>输入数字选择, q 返回/退出</Text>
|
||||||
|
</Box>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { createApp } from "@vue-tui/runtime";
|
||||||
|
import App from "./app.vue";
|
||||||
|
|
||||||
|
createApp(App).mount({ exitOnCtrlC: true });
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
declare module "*.vue" {
|
||||||
|
import type { Component } from "vue";
|
||||||
|
const component: Component;
|
||||||
|
export default component;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"strict": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"types": ["node"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.vue"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import vue from "unplugin-vue/vite";
|
||||||
|
import { vueTui } from "@vue-tui/vite";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
input: "src/main.ts",
|
||||||
|
plugins: [vue(), vueTui()],
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user