Commit f6965f9f by liimin

chore: update gitignore and remove ai-previews from tracking

1 parent 43f6039d
Showing 45 changed files with 2 additions and 2249 deletions
......@@ -82,8 +82,8 @@ vite.config.ts.*
.cursor
# AI 管线中间产物
apps/web/ai-previews/**/.ai-direct/
apps/web/ai-workspace/.ai-direct/
apps/web/ai-workspace/
apps/web/ai-previews/
# 临时调试脚本
scripts/_run-*.mjs
......
{
"generator": "scripts/ai-direct-apply-output.mjs",
"generatedAt": "2026-06-05T08:31:46.360Z",
"model": "qwen3.7-max",
"provider": "openai-compatible",
"files": [
{
"path": "apps/web/ai-previews/diaobo-preview/src/views/diaobo/components/TransferPanel.vue",
"language": "vue",
"purpose": "调拨管理核心面板:调出方/调入方选择表单 + 工具栏 + 调拨列表表格",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T04:23:39.988Z",
"action": "updated"
},
{
"path": "apps/web/ai-previews/diaobo-preview/src/views/db/components/DiaoboConfirmTable.vue",
"language": "vue",
"purpose": "调拨确认单表格组件,展示调拨商品列表信息",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T05:46:56.354Z",
"action": "updated"
},
{
"path": "apps/web/ai-previews/diaobo-preview/src/views/dd.vue",
"language": "vue",
"purpose": "调拨确认单管理页面,展示商品调拨数据表格",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T06:40:05.054Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/diaobo-preview/src/views/Aa.vue",
"language": "vue",
"purpose": "调拨确认单页面,包含标题、数据表格和分页器",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T08:31:36.839Z",
"action": "created"
}
]
}
# 寮€鍙戠幆澧冮厤缃?
# 搴旂敤鍩烘湰淇℃伅
VITE_APP_NAME=寰簲鐢ㄦā鏉?VITE_APP_VERSION=1.0.0
# 寰簲鐢ㄥ悕绉帮紙涓庡熀搴ч厤缃繚鎸佷竴鑷达級
VITE_MICRO_APP_NAME=subapp-vue
# 鏈嶅姟绔彛
VITE_PORT=8081
# API 鍩虹璺緞
VITE_API_BASE_URL=http://localhost:3000/api
VITE_API_TIMEOUT=30000
# 璺敱鍩虹璺緞
VITE_BASE_URL=/subapp-vue
VITE_ROUTER_BASE=/subapp-vue
# 寰簲鐢ㄨ闂矾寰?VITE_PUBLIC_PATH=http://localhost:8081/
# 鏄惁涓哄紑鍙戞ā寮?VITE_USE_DEV_MODE=true
# 鏄惁鍚敤Mock鏁版嵁
VITE_USE_MOCK=false
# 鏄惁鍚敤璋冭瘯妯″紡
VITE_DEBUG=true
# 鍩哄骇搴旂敤鍦板潃
VITE_MAIN_APP_URL=http://localhost:8080
# 鏂囦欢涓婁紶鍦板潃
VITE_UPLOAD_URL=http://localhost:3000/api/upload
# 寮€鍙戠幆澧冩爣璇?NODE_ENV=development
# 鐢熶骇鐜閰嶇疆
# 鐢熶骇鐜鍩虹璺緞
VITE_BASE_URL=/subapp-vue/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Auto-generated files
src/auto-imports.d.ts
src/components.d.ts
# **APP_NAME**
该项目由 Venus CLI 脚手架生成,使用 Vite + Vue 3 + TypeScript。
- 可选 ESLint:注入 `eslint.config.mjs`、`lint` 脚本,以及 `@venus/eslint-config`
/// <reference types="vite/client" />
/// <reference types="vue/jsx" />
declare module "*.vue" {
import type { DefineComponent } from "vue";
const component: DefineComponent<object, object, any>;
export default component;
}
// vue-router 类型声明(模板开发时使用,避免类型错误)
declare module "vue-router" {
export interface RouteMeta {
[key: string]: unknown;
title?: string;
}
export interface RouteLocationNormalized {
[key: string]: unknown;
meta: RouteMeta;
name?: null | string | symbol;
path: string;
}
export type NavigationGuardNext = (to?: false | string) => void;
export interface RouteRecordRaw {
[key: string]: unknown;
component?: unknown;
meta?: RouteMeta;
name?: string | symbol;
path: string;
}
export interface Router {
[key: string]: unknown;
afterEach(guard: (to: RouteLocationNormalized, from: RouteLocationNormalized) => void): () => void;
beforeEach(
guard: (to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => void,
): () => void;
}
export function createRouter(options: { history: unknown; routes: RouteRecordRaw[] }): Router;
export function createWebHistory(base?: string): unknown;
// 导出所有需要的类型
export type { NavigationGuardNext, RouteLocationNormalized, Router, RouteRecordRaw };
}
// qiankun 相关类型
declare global {
interface Window {
__INJECTED_PUBLIC_PATH_BY_QIANKUN__?: string;
__POWERED_BY_QIANKUN__?: boolean;
}
}
export {};
// @ts-check
// 模板文件在仓库内校验时不会自动拥有生成后项目的依赖图。
// eslint-disable-next-line n/no-extraneous-import
import { defineConfig } from "@venus/eslint-config";
export default defineConfig([
{
files: ["**/*.ts", "**/*.tsx", "**/*.vue"],
languageOptions: {
parserOptions: {
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: import.meta.dirname,
},
},
},
]);
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vue3 微前端子应用</title>
<meta name="description" content="基于 qiankun + Vue3 + Vite 的微前端子应用模板" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
{
"name": "@venus/diaobo-preview",
"version": "1.0.0",
"description": "Vue3 微前端子应用模板,用于与 qiankun 基座集成",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --port 8081 --host",
"build": "vue-tsc && vite build",
"preview": "vite preview --port 8081",
"type-check": "vue-tsc --noEmit",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@vueuse/core": "catalog:",
"@vui/vue": "workspace:*",
"element-plus": "catalog:",
"pinia": "catalog:",
"vue": "catalog:",
"vue-router": "catalog:"
},
"devDependencies": {
"@types/node": "catalog:",
"@venus/eslint-config": "workspace:*",
"@vitejs/plugin-vue": "catalog:",
"@vitejs/plugin-vue-jsx": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:",
"unplugin-auto-import": "catalog:",
"unplugin-vue-components": "catalog:",
"vite": "catalog:",
"vite-plugin-qiankun": "catalog:",
"vue-tsc": "catalog:"
}
}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
<template>
<div id="micro-app" class="micro-app-container">
<main class="app-main">
<router-view v-slot="{ Component }">
<transition mode="out-in" name="fade">
<component :is="Component" />
</transition>
</router-view>
</main>
</div>
</template>
<style scoped>
.micro-app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
background: #f5f7fa;
}
.app-main {
flex: 1;
padding: 24px;
}
/* 路由过渡动画 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
@media (max-width: 768px) {
.app-main {
padding: 16px;
}
}
</style>
// / <reference types="vite/client" />
import type { QiankunProps } from "vite-plugin-qiankun/dist/helper";
import type { App as VueApp } from "vue";
import { createApp } from "vue";
import { createPinia } from "pinia";
import { qiankunWindow, renderWithQiankun } from "vite-plugin-qiankun/dist/helper";
import App from "./App.vue";
import { createRouter } from "./router";
import { setupUI } from "./ui";
import "element-plus/dist/index.css";
import "./style.css";
let app: null | VueApp<Element> = null;
let router: any = null;
/**
* 渲染函数
* @param props qiankun 传递的参数
*/
async function render(props: QiankunProps = {}) {
const { container } = props;
app = createApp(App);
// 配置 Pinia
app.use(createPinia());
setupUI(app);
// 配置路由 - 根据是否在 qiankun 环境中使用不同的 base
const routerBase = qiankunWindow.__POWERED_BY_QIANKUN__ ? props.routerBase || "/subapp-vue" : "/";
router = createRouter(routerBase);
app.use(router);
// 初始化通信管理器(仅在 qiankun 环境中)
if (qiankunWindow.__POWERED_BY_QIANKUN__ && props.onGlobalStateChange) {
const { subAppCommunication } = await import("./utils/communication");
subAppCommunication.init(props);
// 将通信管理器挂载到全局属性,方便组件使用
app.config.globalProperties.$communication = subAppCommunication;
}
// 挂载应用
const containerEl = container ? container.querySelector("#app") : document.querySelector("#app");
if (containerEl) {
app.mount(containerEl as Element);
} else {
console.error("[Vue3 微应用] 挂载容器未找到");
}
}
/**
* 独立运行时
* 直接访问子应用时,不是通过基座加载
*/
if (!qiankunWindow.__POWERED_BY_QIANKUN__) {
console.log("独立运行模式");
render();
}
/**
* qiankun 生命周期钩子 - bootstrap
* 只会在微应用初始化的时候调用一次,下次微应用重新进入时会直接调用 mount 钩子
*/
export async function bootstrap() {
console.log("[Vue3 微应用] bootstrap");
}
/**
* qiankun 生命周期钩子 - mount
* 应用每次进入都会调用 mount 方法,通常在这里触发应用的渲染方法
*/
export async function mount(props: QiankunProps) {
console.log("Vue3 微应用 mount", props);
render(props);
}
/**
* qiankun 生命周期钩子 - unmount
* 应用每次切出/卸载都会调用 unmount 方法
*/
export async function unmount(props: QiankunProps) {
console.log("[Vue3 微应用] unmount", props);
// 销毁通信管理器
if (qiankunWindow.__POWERED_BY_QIANKUN__) {
const { subAppCommunication } = await import("./utils/communication");
subAppCommunication.destroy();
}
if (app) {
app.unmount();
app = null;
}
if (router) {
router = null;
}
}
/**
* qiankun 生命周期钩子 - update (可选)
* 主应用向子应用下发新的props时触发
*/
export async function update(props: QiankunProps) {
console.log("[Vue3 微应用] update", props);
}
// 使用 vite-plugin-qiankun 提供的渲染函数
renderWithQiankun({
bootstrap,
mount,
unmount,
update,
});
import type { Router } from "vue-router";
import {
createRouter as _createRouter,
createWebHistory,
} from "vue-router";
const routes = [
{
path: "/",
name: "Home",
component: () => import("../views/Home.vue"),
},
{
path: "/about",
name: "About",
component: () => import("@/views/About.vue"),
meta: {
title: "About",
},
},
{
path: "/communication",
name: "Communication",
component: () => import("@/views/Communication.vue"),
meta: {
title: "Communication",
},
},
{
path: "/",
name: "Home",
component: () => import("@/views/Home.vue"),
meta: {
title: "Home",
},
},
{
path: "/settings",
name: "Settings",
component: () => import("@/views/Settings.vue"),
meta: {
title: "Settings",
},
},
{
path: "/user",
name: "User",
component: () => import("@/views/User.vue"),
meta: {
title: "User",
},
}
];
export function createRouter(base = "/"): Router {
return _createRouter({
history: createWebHistory(base),
routes,
});
}
const router = createRouter();
export default router;
import { createPinia } from "pinia";
export const pinia = createPinia();
/* 全局样式 */
* {
box-sizing: border-box;
}
:root {
font-family:
"PingFang SC",
"Microsoft YaHei",
Inter,
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
font-weight: 400;
line-height: 1.5;
color: #1f2329;
background-color: #f5f7fa;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html,
body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
body {
min-width: 320px;
min-height: 100vh;
margin: 0;
color: #1f2329;
background: #f5f7fa;
}
#app {
width: 100%;
min-height: 100vh;
}
/* 滚动条样式 */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: #eef1f5;
}
::-webkit-scrollbar-thumb {
background: #c4cad4;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #aab2bf;
}
/* 选中文本样式 */
::selection {
color: #ffffff;
background: rgb(64 158 255 / 75%);
}
/* 响应式 */
@media (max-width: 768px) {
body {
font-size: 14px;
}
}
import type { App } from "vue";
import { VButton, VDialog, VInput, VSelect, VTable } from "@vui/vue";
import ElementPlus from "element-plus";
export function setupUI(app: App) {
app.use(ElementPlus);
app.component("VButton", VButton);
app.component("VDialog", VDialog);
app.component("VInput", VInput);
app.component("VSelect", VSelect);
app.component("VTable", VTable);
}
import { onUnmounted } from "vue";
/**
* 全局状态接口定义(与基座保持一致)
*/
export interface GlobalState {
config: {
apiBaseUrl: string;
timeout: number;
};
notifications: Notification[];
theme: {
mode: "dark" | "light";
primaryColor: string;
};
user: null | {
avatar: string;
id: string;
name: string;
permissions: string[];
role: string;
};
}
/**
* 通知消息接口
*/
export interface Notification {
from?: string;
id: string;
message: string;
timestamp: number;
title: string;
type: "error" | "info" | "success" | "warning";
}
/**
* qiankun Props 类型定义
*/
export interface QiankunProps {
[key: string]: any;
container?: HTMLElement;
onGlobalStateChange?: (
callback: (state: GlobalState, prev: GlobalState) => void,
fireImmediately?: boolean,
) => void;
routerBase?: string;
setGlobalState?: (state: Partial<GlobalState>) => void;
}
/**
* 子应用通信管理器
*/
class SubAppCommunicationManager {
private currentState: GlobalState | null = null; // 缓存当前状态
private listeners: Array<(state: GlobalState, prev: GlobalState) => void> = [];
private props: null | QiankunProps = null;
private unsubscribe: (() => void) | null = null;
/**
* 销毁
*/
destroy() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
this.listeners = [];
this.props = null;
console.log("[子应用通信] 通信管理器已销毁");
}
/**
* 获取当前全局状态
*/
getCurrentState(): GlobalState | null {
return this.currentState;
}
/**
* 初始化通信管理器
* @param props qiankun 传递的 props
*/
init(props: QiankunProps) {
this.props = props;
// 监听全局状态变化
if (props.onGlobalStateChange) {
const unsubscribeFn = props.onGlobalStateChange(
(state: GlobalState, prev: GlobalState) => {
console.log("[子应用通信] 全局状态变化:", state, prev);
// 缓存当前状态
this.currentState = state;
// 触发所有监听器
this.listeners.forEach((listener) => {
listener(state, prev);
});
},
true, // 立即触发,获取当前状态 - 这确保了微应用一加载就能获取主应用的数据
);
// 只在返回值是函数时才赋值
if (typeof unsubscribeFn === "function") {
this.unsubscribe = unsubscribeFn;
}
}
}
/**
* 监听全局状态变化
* @param callback 回调函数
* @returns 取消监听的函数
*/
onStateChange(callback: (state: GlobalState, prev: GlobalState) => void): () => void {
this.listeners.push(callback);
// 如果已经有缓存的状态,立即调用一次回调
if (this.currentState) {
console.log("[子应用通信] 立即触发回调,使用缓存的全局状态");
callback(this.currentState, {} as GlobalState);
}
return () => {
const index = this.listeners.indexOf(callback);
if (index !== -1) {
this.listeners.splice(index, 1);
}
};
}
/**
* 向基座发送通知
* @param notification 通知消息
*/
sendNotification(notification: Omit<Notification, "id" | "timestamp">) {
if (!this.props?.setGlobalState) {
console.warn("[子应用通信] 无法发送通知,setGlobalState 方法不可用");
return;
}
// 获取当前通知列表(需要通过 props 或缓存获取)
// 这里简化处理,直接通过 state 添加
const newNotification: Notification = {
...notification,
id: Date.now().toString(),
timestamp: Date.now(),
from: notification.from || "Vue子应用",
};
// 通过修改全局状态来添加通知
// 注意:这里需要基座的 communication manager 来处理通知添加逻辑
// 所以我们实际上是触发一个状态变化,让基座来处理
this.setGlobalState({
notifications: [ newNotification ] as any, // 基座会合并到现有通知列表
});
}
/**
* 设置全局状态(向基座发送数据)
* @param state 要更新的状态
*/
setGlobalState(state: Partial<GlobalState>) {
if (this.props?.setGlobalState) {
this.props.setGlobalState(state);
console.log("[子应用通信] 全局状态已更新:", state);
} else {
console.warn("[子应用通信] setGlobalState 方法不可用");
}
}
}
// 导出单例
export const subAppCommunication = new SubAppCommunicationManager();
/**
* Vue 组合式 API - 使用全局状态
* @param callback 状态变化回调
*/
export function useGlobalState(callback: (state: GlobalState, prev: GlobalState) => void) {
const unsubscribe = subAppCommunication.onStateChange(callback);
// 在组件卸载时自动取消订阅
onUnmounted(() => {
unsubscribe();
});
return unsubscribe;
}
/**
* 便捷方法:发送通知到基座
*/
export function notify(type: Notification["type"], title: string, message: string) {
subAppCommunication.sendNotification({
type,
title,
message,
});
}
<template>
<div class="about-view">
<div class="content-card">
<h1>📖 关于本应用</h1>
<section class="section">
<h2>技术栈</h2>
<ul class="tech-list">
<li>
<strong>Vue 3</strong>
- 渐进式 JavaScript 框架
</li>
<li>
<strong>TypeScript</strong>
- 类型安全的 JavaScript 超集
</li>
<li>
<strong>Vite</strong>
- 新一代前端构建工具
</li>
<li>
<strong>Vue Router</strong>
- 官方路由管理器
</li>
<li>
<strong>Pinia</strong>
- 新一代状态管理库
</li>
<li>
<strong>qiankun</strong>
- 微前端框架
</li>
</ul>
</section>
<section class="section">
<h2>功能特性</h2>
<ul class="feature-list">
<li>✅ 支持独立运行和基座集成</li>
<li>✅ 完整的 TypeScript 支持</li>
<li>✅ 自动导入 API 和组件</li>
<li>✅ 热模块替换 (HMR)</li>
<li>✅ 路由懒加载</li>
<li>✅ CSS 样式隔离</li>
</ul>
</section>
<section class="section">
<h2>快速开始</h2>
<div class="code-block">
<pre>
<code>
# 安装依赖
pnpm install
# 启动开发服务器
pnpm dev
# 构建生产版本
pnpm build
</code>
</pre>
</div>
</section>
</div>
</div>
</template>
<script setup lang="ts">
// About 页面
</script>
<style scoped>
.about-view {
max-width: 900px;
margin: 0 auto;
}
.content-card {
padding: 2.5rem;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.content-card h1 {
margin: 0 0 2rem;
font-size: 2rem;
}
.section {
margin-bottom: 2rem;
}
.section h2 {
margin: 0 0 1rem;
font-size: 1.5rem;
color: rgb(255 255 255 / 95%);
}
.tech-list,
.feature-list {
padding: 0;
margin: 0;
list-style: none;
}
.tech-list li,
.feature-list li {
padding: 0.5rem 0;
line-height: 1.6;
opacity: 0.9;
}
.code-block {
padding: 1.5rem;
overflow-x: auto;
background: rgb(0 0 0 / 30%);
border: 1px solid rgb(255 255 255 / 10%);
border-radius: 0.5rem;
}
.code-block pre {
margin: 0;
font-family: "Courier New", monospace;
font-size: 0.9rem;
line-height: 1.6;
}
.code-block code {
color: #a8e6cf;
}
</style>
<template>
<div class="notfound-view">
<div class="content-card">
<div class="error-code">
404
</div>
<h1>页面未找到</h1>
<p>抱歉,您访问的页面不存在或已被删除</p>
<button class="btn-home" @click="goHome">
🏠 返回首页
</button>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from "vue-router";
const router = useRouter();
const goHome = () => {
router.push("/");
};
</script>
<style scoped>
.notfound-view {
display: flex;
align-items: center;
justify-content: center;
max-width: 600px;
min-height: 400px;
margin: 0 auto;
}
.content-card {
padding: 3rem;
text-align: center;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.error-code {
margin-bottom: 1rem;
font-size: 6rem;
font-weight: 700;
background: linear-gradient(45deg, #fff, rgb(255 255 255 / 60%));
background-clip: text;
-webkit-text-fill-color: transparent;
}
.content-card h1 {
margin: 0 0 1rem;
font-size: 2rem;
}
.content-card p {
margin: 0 0 2rem;
opacity: 0.9;
}
.btn-home {
padding: 0.75rem 2rem;
font-size: 1rem;
font-weight: 600;
color: white;
cursor: pointer;
background: rgb(76 175 80 / 80%);
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-home:hover {
background: rgb(76 175 80 / 100%);
transform: translateY(-2px);
}
</style>
<template>
<div class="settings-view">
<div class="content-card">
<h1>⚙️ 系统设置</h1>
<div class="settings-grid">
<div class="setting-group">
<h2>🎨 主题设置</h2>
<div class="setting-item">
<label>主题色:</label>
<select v-model="settings.theme" class="select-input">
<option value="purple">
紫色
</option>
<option value="blue">
蓝色
</option>
<option value="green">
绿色
</option>
<option value="orange">
橙色
</option>
</select>
</div>
<div class="setting-item">
<label>暗黑模式:</label>
<input v-model="settings.darkMode"
class="checkbox-input"
type="checkbox" />
</div>
</div>
<div class="setting-group">
<h2>🔔 通知设置</h2>
<div class="setting-item">
<label>桌面通知:</label>
<input v-model="settings.notifications.desktop"
class="checkbox-input"
type="checkbox" />
</div>
<div class="setting-item">
<label>邮件通知:</label>
<input v-model="settings.notifications.email"
class="checkbox-input"
type="checkbox" />
</div>
<div class="setting-item">
<label>短信通知:</label>
<input v-model="settings.notifications.sms"
class="checkbox-input"
type="checkbox" />
</div>
</div>
<div class="setting-group">
<h2>🌐 语言设置</h2>
<div class="setting-item">
<label>界面语言:</label>
<select v-model="settings.language" class="select-input">
<option value="zh-CN">
简体中文
</option>
<option value="en-US">
English
</option>
<option value="ja-JP">
日本語
</option>
</select>
</div>
<div class="setting-item">
<label>时区:</label>
<select v-model="settings.timezone" class="select-input">
<option value="Asia/Shanghai">
北京时间 (UTC+8)
</option>
<option value="America/New_York">
纽约时间 (UTC-5)
</option>
<option value="Europe/London">
伦敦时间 (UTC+0)
</option>
</select>
</div>
</div>
<div class="setting-group">
<h2>🔒 安全设置</h2>
<div class="setting-item">
<label>双因素认证:</label>
<input v-model="settings.security.twoFactor"
class="checkbox-input"
type="checkbox" />
</div>
<div class="setting-item">
<label>会话超时 (分钟):</label>
<input v-model="settings.security.sessionTimeout"
class="number-input"
max="120"
min="5"
type="number" />
</div>
</div>
</div>
<div class="actions">
<button class="btn-save" @click="saveSettings">
💾 保存设置
</button>
<button class="btn-reset" @click="resetSettings">
🔄 重置默认
</button>
</div>
<div class="current-settings">
<h3>当前配置 (JSON)</h3>
<pre>{{ JSON.stringify(settings, null, 2) }}</pre>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { reactive } from "vue";
interface Settings {
darkMode: boolean;
language: string;
notifications: {
desktop: boolean;
email: boolean;
sms: boolean;
};
security: {
sessionTimeout: number;
twoFactor: boolean;
};
theme: string;
timezone: string;
}
const defaultSettings: Settings = {
theme: "purple",
darkMode: false,
notifications: {
desktop: true,
email: true,
sms: false,
},
language: "zh-CN",
timezone: "Asia/Shanghai",
security: {
twoFactor: false,
sessionTimeout: 30,
},
};
const settings = reactive<Settings>({ ...defaultSettings });
const saveSettings = () => {
console.log("保存设置:", settings);
// eslint-disable-next-line
alert("设置已保存!");
};
const resetSettings = () => {
// eslint-disable-next-line
if (confirm("确定要重置为默认设置吗?")) {
Object.assign(settings, defaultSettings);
// eslint-disable-next-line
alert("已重置为默认设置!");
}
};
</script>
<style scoped>
.settings-view {
max-width: 1200px;
margin: 0 auto;
}
.content-card {
padding: 2.5rem;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.content-card h1 {
margin: 0 0 2rem;
font-size: 2rem;
}
.settings-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-bottom: 2rem;
}
.setting-group {
padding: 1.5rem;
background: rgb(255 255 255 / 5%);
border: 1px solid rgb(255 255 255 / 10%);
border-radius: 0.75rem;
}
.setting-group h2 {
margin: 0 0 1rem;
font-size: 1.2rem;
color: rgb(255 255 255 / 95%);
}
.setting-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1rem;
}
.setting-item label {
font-weight: 500;
}
.select-input,
.number-input {
padding: 0.5rem;
font-size: 0.9rem;
color: white;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 0.5rem;
}
.number-input {
width: 80px;
}
.checkbox-input {
width: 20px;
height: 20px;
cursor: pointer;
}
.actions {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
}
.btn-save,
.btn-reset {
padding: 0.75rem 2rem;
font-weight: 600;
cursor: pointer;
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-save {
color: white;
background: rgb(76 175 80 / 80%);
}
.btn-save:hover {
background: rgb(76 175 80 / 100%);
transform: translateY(-2px);
}
.btn-reset {
color: white;
background: rgb(158 158 158 / 80%);
}
.btn-reset:hover {
background: rgb(158 158 158 / 100%);
transform: translateY(-2px);
}
.current-settings {
padding: 1.5rem;
background: rgb(0 0 0 / 30%);
border: 1px solid rgb(255 255 255 / 10%);
border-radius: 0.75rem;
}
.current-settings h3 {
margin: 0 0 1rem;
font-size: 1.1rem;
}
.current-settings pre {
margin: 0;
overflow-x: auto;
font-family: "Courier New", monospace;
font-size: 0.9rem;
line-height: 1.6;
color: #a8e6cf;
}
</style>
<template>
<div class="user-view">
<div class="content-card">
<h1>👥 用户管理</h1>
<div class="toolbar">
<button class="btn-add" @click="addUser">
➕ 新增用户
</button>
</div>
<div class="table-container">
<table class="user-table">
<thead>
<tr>
<th>ID</th>
<th>姓名</th>
<th>邮箱</th>
<th>角色</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="user in users" :key="user.id">
<td>{{ user.id }}</td>
<td>{{ user.name }}</td>
<td>{{ user.email }}</td>
<td>
<span class="badge" :class="`badge-${user.role}`">
{{ user.role }}
</span>
</td>
<td>
<span class="status" :class="user.active ? 'status-active' : 'status-inactive'">
{{ user.active ? "在线" : "离线" }}
</span>
</td>
<td>
<button class="btn-edit" @click="editUser(user)">
编辑
</button>
<button class="btn-delete" @click="deleteUser(user.id)">
删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
interface User {
active: boolean;
email: string;
id: number;
name: string;
role: "admin" | "guest" | "user";
}
const users = ref<User[]>([
{
id: 1,
name: "张三",
email: "zhangsan@example.com",
role: "admin",
active: true,
},
{
id: 2,
name: "李四",
email: "lisi@example.com",
role: "user",
active: true,
},
{
id: 3,
name: "王五",
email: "wangwu@example.com",
role: "user",
active: false,
},
{
id: 4,
name: "赵六",
email: "zhaoliu@example.com",
role: "guest",
active: true,
},
]);
const addUser = () => {
const newUser: User = {
id: users.value.length + 1,
name: `新用户${users.value.length + 1}`,
email: `user${users.value.length + 1}@example.com`,
role: "user",
active: true,
};
users.value.push(newUser);
};
const editUser = (user: User) => {
console.log("编辑用户:", user);
// eslint-disable-next-line
alert(`编辑用户: ${user.name}`);
};
const deleteUser = (id: number) => {
const index = users.value.findIndex((u) => u.id === id);
// eslint-disable-next-line
if (index !== -1 && confirm(`确定要删除用户 ${users.value[index].name} 吗?`)) {
users.value.splice(index, 1);
}
};
</script>
<style scoped>
.user-view {
max-width: 1200px;
margin: 0 auto;
}
.content-card {
padding: 2.5rem;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.content-card h1 {
margin: 0 0 1.5rem;
font-size: 2rem;
}
.toolbar {
margin-bottom: 1.5rem;
}
.btn-add {
padding: 0.75rem 1.5rem;
font-weight: 600;
color: white;
cursor: pointer;
background: rgb(76 175 80 / 80%);
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-add:hover {
background: rgb(76 175 80 / 100%);
transform: translateY(-2px);
}
.table-container {
overflow-x: auto;
}
.user-table {
width: 100%;
border-collapse: collapse;
}
.user-table thead {
background: rgb(255 255 255 / 10%);
}
.user-table th,
.user-table td {
padding: 1rem;
text-align: left;
border-bottom: 1px solid rgb(255 255 255 / 10%);
}
.user-table th {
font-weight: 600;
color: rgb(255 255 255 / 95%);
}
.user-table tbody tr {
transition: background 0.3s ease;
}
.user-table tbody tr:hover {
background: rgb(255 255 255 / 5%);
}
.badge {
padding: 0.25rem 0.75rem;
font-size: 0.85rem;
font-weight: 600;
border-radius: 1rem;
}
.badge-admin {
background: rgb(244 67 54 / 80%);
}
.badge-user {
background: rgb(33 150 243 / 80%);
}
.badge-guest {
background: rgb(158 158 158 / 80%);
}
.status {
padding: 0.25rem 0.75rem;
font-size: 0.85rem;
font-weight: 600;
border-radius: 1rem;
}
.status-active {
background: rgb(76 175 80 / 80%);
}
.status-inactive {
background: rgb(158 158 158 / 80%);
}
.btn-edit,
.btn-delete {
padding: 0.5rem 1rem;
margin-right: 0.5rem;
font-weight: 600;
cursor: pointer;
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-edit {
color: white;
background: rgb(33 150 243 / 80%);
}
.btn-edit:hover {
background: rgb(33 150 243 / 100%);
}
.btn-delete {
color: white;
background: rgb(244 67 54 / 80%);
}
.btn-delete:hover {
background: rgb(244 67 54 / 100%);
}
</style>
{
"compilerOptions": {
"target": "ES2020",
"jsx": "preserve",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"useDefineForClassFields": true,
/* Path Alias */
"baseUrl": ".",
"module": "ESNext",
/* Bundler mode */
"moduleResolution": "bundler",
"paths": {
"@/*": ["src/*"]
},
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
/* Linting */
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noEmit": true,
"isolatedModules": true,
"skipLibCheck": true
},
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "env.d.ts"]
}
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"include": ["vite.config.ts"]
}
import { resolve } from "node:path";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { defineConfig } from "vite";
import qiankun from "vite-plugin-qiankun";
const PORT = 8081;
const APP_NAME = "subapp-vue"; // 与基座配置的 name 一致
export default defineConfig(({ mode, command }) => {
const isDev = mode === "development";
const isServe = command === "serve";
return {
base: isDev && isServe ? `http://localhost:${PORT}/` : `/${APP_NAME}/`, // 生产环境使用应用名作为基础路径
plugins: [
vue(),
vueJsx(),
// 自动导入 Vue 相关函数
AutoImport({
imports: [ "vue", "vue-router", "pinia" ],
dts: "src/auto-imports.d.ts",
eslintrc: {
enabled: false,
},
}),
// 自动导入组件
Components({
dts: "src/components.d.ts",
}),
// qiankun 插件配置
qiankun(APP_NAME, {
useDevMode: isDev, // 根据实际环境动态设置
}),
],
resolve: {
alias: {
"@": resolve(import.meta.dirname, "src"),
},
},
server: {
port: PORT,
cors: true, // 允许跨域
host: true,
origin: `http://localhost:${PORT}`, // 设置资源加载的 origin
headers: {
"Access-Control-Allow-Origin": "*", // 允许所有来源
},
},
build: {
target: "esnext",
minify: false, // 开发环境不压缩,便于调试
cssCodeSplit: false, // css 不拆分
rollupOptions: {
output: {
// qiankun 需要的输出格式
format: "umd",
// UMD 库名称,必须与应用名称一致
name: `qiankunApp_${APP_NAME.replaceAll("-", "_")}`,
entryFileNames: "assets/[name].js",
chunkFileNames: "assets/[name].[hash].js",
assetFileNames: "assets/[name].[hash].[ext]",
},
},
},
};
});
{
"generator": "scripts/ai-direct-apply-output.mjs",
"generatedAt": "2026-06-08T03:41:53.670Z",
"model": "qwen3.7-max",
"provider": "openai-compatible",
"files": [
{
"path": "apps/web/ai-previews/testpage-preview/src/views/aa/components/Node5971297.vue",
"language": "vue",
"purpose": "车辆图片画廊组件,展示车辆图片、分类标签切换和图片计数",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:12:39.213Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/aa/components/Node5971239.vue",
"language": "vue",
"purpose": "二手车商品详情卡片组件,展示车辆图片、标题、标签、车源号、起拍价和倒计时",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:14:05.710Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/aa/components/Node4371036.vue",
"language": "vue",
"purpose": "车辆详情信息组件,包含基础统计卡片和详细参数列表",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:15:29.539Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/www/components/Node640708.vue",
"language": "vue",
"purpose": "参拍详情页面顶部导航栏,包含标题和返回按钮",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:41:13.426Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/www/components/Node5971297.vue",
"language": "vue",
"purpose": "车辆图片查看器组件,包含图片轮播区域、拍卖规则浮标、外观/内饰切换标签和照片计数器",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:42:05.277Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/www/components/Node5971239.vue",
"language": "vue",
"purpose": "二手车详情卡片组件,展示车辆图片、标题、标签、车源号、起拍价和倒计时",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:43:21.278Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/www/components/Node4371036.vue",
"language": "vue",
"purpose": "二手车车辆详细信息卡片,包含核心指标展示和详细参数列表",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:44:10.258Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/www/components/Node531720.vue",
"language": "vue",
"purpose": "底部竞拍操作栏,包含固定定位的白色底栏和蓝色",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T03:44:52.996Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/dd/components/Detailnavbar.vue",
"language": "vue",
"purpose": "参拍详情页顶部导航栏,包含返回按钮和页面标题",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T04:10:37.869Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/dd/components/Cargallery.vue",
"language": "vue",
"purpose": "二手车图片画廊组件,包含图片展示、拍卖规则标签、外观/内饰切换和照片计数",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T04:11:31.541Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/dd/components/Cardetailcard.vue",
"language": "vue",
"purpose": "二手车商品详情卡片组件,展示车辆图片、标题、标签、车源号、起拍价和倒计时",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T04:12:45.067Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/dd/components/Vehicleinfocard.vue",
"language": "vue",
"purpose": "车辆信息详情卡片,包含上牌概览和详细参数键值对",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T04:13:45.817Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/aa.vue",
"language": "vue",
"purpose": "广联二手车油车详情页,包含图片轮播、车辆信息、检测报告等完整模块",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T08:48:42.712Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/mm/index.vue",
"language": "vue",
"purpose": "广联二手车完整车辆信息页面",
"coAuthor": "@ai-co-author venus-ai-direct | unknown-provider/unknown-model | 2026-06-05T09:27:48.328Z",
"action": "updated"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/tt/index.vue",
"language": "vue",
"purpose": "广联二手车首页 - 包含导航栏、搜索、热搜品牌、吸顶Tab和车辆卡片列表",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-08T03:39:06.097Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/vv/index.vue",
"language": "vue",
"purpose": "广联二手车首页,包含导航栏、搜索、Banner、功能入口、品牌、筛选标签、车辆列表和底部导航",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T10:16:12.211Z",
"action": "created"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/views/vvv/index.vue",
"language": "vue",
"purpose": "广联二手车首页,包含导航栏、搜索、分类入口、筛选标签、热搜品牌和车辆卡片列表",
"coAuthor": "@ai-co-author venus-ai-direct | openai-compatible/qwen3.7-max | 2026-06-05T10:34:23.232Z",
"action": "created"
}
]
}
# testpage-preview
Venus 移动端 H5 应用。
## 开发
```bash
pnpm dev
```
## 构建
```bash
pnpm build
```
/// <reference types="vite/client" />
/// <reference types="vue/jsx" />
declare module "*.vue" {
import type { DefineComponent } from "vue";
const component: DefineComponent<object, object, unknown>;
export default component;
}
import { vue as vueConfig } from "@venus/eslint-config";
export default [...vueConfig];
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<title>移动端应用</title>
<meta name="description" content="Venus 移动端 H5 应用" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
{
"name": "@venus/testpage-preview",
"version": "1.0.0",
"description": "Venus 移动端 H5 应用模板,基于 Vue 3 + Vite + @vui/mobile",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --port 3200 --host",
"build": "vue-tsc && vite build",
"preview": "vite preview --port 3200",
"type-check": "vue-tsc --noEmit",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@vueuse/core": "catalog:",
"@vui/mobile": "workspace:*",
"pinia": "catalog:",
"vant": "catalog:",
"vue": "catalog:",
"vue-router": "catalog:"
},
"devDependencies": {
"@types/node": "catalog:",
"@vant/auto-import-resolver": "catalog:",
"@venus/eslint-config": "workspace:*",
"@vitejs/plugin-vue": "catalog:",
"@vitejs/plugin-vue-jsx": "catalog:",
"@vue/typescript-plugin": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:",
"unplugin-auto-import": "catalog:",
"unplugin-vue-components": "catalog:",
"vite": "catalog:",
"vue-tsc": "catalog:"
},
"_comment": "@vui/mobile 和 vant 已在基础 package.json 中声明。此 optional 能力仅用于额外配置或未来扩展。"
}
<template>
<div id="mobile-app" class="mobile-app-container">
<router-view v-slot="{ Component }">
<transition mode="out-in" name="slide">
<component :is="Component" />
</transition>
</router-view>
</div>
</template>
<style scoped>
.mobile-app-container {
min-height: 100vh;
background: #f7f8fa;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.slide-enter-active,
.slide-leave-active {
transition: opacity 0.2s ease, transform 0.2s ease;
}
.slide-enter-from {
opacity: 0;
transform: translateX(20px);
}
.slide-leave-to {
opacity: 0;
transform: translateX(-20px);
}
</style>
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const createPinia: typeof import('pinia')['createPinia']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const defineStore: typeof import('pinia')['defineStore']
const effectScope: typeof import('vue')['effectScope']
const getActivePinia: typeof import('pinia')['getActivePinia']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const mapActions: typeof import('pinia')['mapActions']
const mapGetters: typeof import('pinia')['mapGetters']
const mapState: typeof import('pinia')['mapState']
const mapStores: typeof import('pinia')['mapStores']
const mapWritableState: typeof import('pinia')['mapWritableState']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const setActivePinia: typeof import('pinia')['setActivePinia']
const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const storeToRefs: typeof import('pinia')['storeToRefs']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useId: typeof import('vue')['useId']
const useLink: typeof import('vue-router')['useLink']
const useModel: typeof import('vue')['useModel']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
VanIcon: typeof import('vant/es')['Icon']
VanSwipe: typeof import('vant/es')['Swipe']
VanSwipeItem: typeof import('vant/es')['SwipeItem']
VanTabbarItem: typeof import('vant/es')['TabbarItem']
VButton: typeof import('@vui/mobile')['VButton']
VCell: typeof import('@vui/mobile')['VCell']
VNavBar: typeof import('@vui/mobile')['VNavBar']
VSearch: typeof import('@vui/mobile')['VSearch']
VTabbar: typeof import('@vui/mobile')['VTabbar']
}
}
import { createApp } from "vue";
import { createPinia } from "pinia";
import App from "./App.vue";
import { createRouter } from "./router";
import { setupUI } from "./ui";
import "vant/lib/index.css";
import "./style.css";
const app = createApp(App);
app.use(createPinia());
setupUI(app);
const router = createRouter();
app.use(router);
app.mount("#app");
import type { Router } from "vue-router";
import { createRouter as _createRouter, createWebHistory } from "vue-router";
const routes = [
{
path: "/",
name: "Home",
component: () => import("../views/Home.vue"),
},
{
path: "/",
name: "Home",
component: () => import("@/views/Home.vue"),
meta: {
title: "Home",
},
}
,
{
path: "/tt",
name: "tt",
component: () => import("@/views/tt/index.vue"),
meta: {
title: "tt",
},
},
];
export function createRouter(): Router {
return _createRouter({
history: createWebHistory(),
routes,
});
}
:root {
--app-bg: #f7f8fa;
--text-primary: #323233;
--text-secondary: #969799;
--border-color: #ebedf0;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
min-height: 100vh;
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
font-size: 14px;
color: var(--text-primary);
background: var(--app-bg);
-webkit-tap-highlight-color: transparent;
}
a {
color: inherit;
text-decoration: none;
}
img {
max-width: 100%;
height: auto;
vertical-align: middle;
}
import type { App } from "vue";
import {
VButton,
VCard,
VCell,
VDropdownItem,
VDropdownMenu,
VField,
VImage,
VList,
VNavBar,
VPicker,
VPopup,
VSearch,
VSwiper,
VTabbar,
VTabs,
} from "@vui/mobile";
import "vant/lib/index.css";
export function setupUI(app: App) {
app.component("VButton", VButton);
app.component("VCard", VCard);
app.component("VCell", VCell);
app.component("VDropdownItem", VDropdownItem);
app.component("VDropdownMenu", VDropdownMenu);
app.component("VField", VField);
app.component("VImage", VImage);
app.component("VList", VList);
app.component("VNavBar", VNavBar);
app.component("VPicker", VPicker);
app.component("VPopup", VPopup);
app.component("VSearch", VSearch);
app.component("VSwiper", VSwiper);
app.component("VTabbar", VTabbar);
app.component("VTabs", VTabs);
}
<template>
<div class="home-page">
<h1 class="page-title">
首页
</h1>
<p class="page-desc">
Venus 移动端 H5 应用已就绪
</p>
</div>
</template>
<style scoped>
.home-page {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 80vh;
padding: 24px;
}
.page-title {
margin-bottom: 8px;
font-size: 24px;
font-weight: 600;
color: var(--text-primary, #323233);
}
.page-desc {
font-size: 14px;
color: var(--text-secondary, #969799);
}
</style>
{
"compilerOptions": {
"target": "ES2020",
"jsx": "preserve",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"useDefineForClassFields": true,
"baseUrl": ".",
"module": "ESNext",
"moduleResolution": "bundler",
"paths": {
"@/*": ["src/*"]
},
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noEmit": true,
"isolatedModules": true,
"skipLibCheck": true,
"plugins": [
{ "name": "@vue/typescript-plugin", "languages": ["vue"] }
]
},
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "env.d.ts"]
}
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true,
"noEmit": true
},
"include": ["vite.config.ts"]
}
import { resolve } from "node:path";
import { VantResolver } from "@vant/auto-import-resolver";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { defineConfig } from "vite";
const VUI_COMPONENTS = new Set([
"VButton",
"VCell",
"VDropdownItem",
"VDropdownMenu",
"VField",
"VList",
"VNavBar",
"VPicker",
"VPopup",
"VSearch",
"VTabbar",
]);
function VuiResolver(name: string) {
if (VUI_COMPONENTS.has(name)) {
return { name, from: "@vui/mobile" };
}
}
const PORT = 3200;
export default defineConfig({
plugins: [
vue(),
vueJsx(),
AutoImport({
imports: ["vue", "vue-router", "pinia"],
dts: "src/auto-imports.d.ts",
eslintrc: { enabled: false },
}),
Components({
resolvers: [VuiResolver, VantResolver()],
dts: "src/components.d.ts",
}),
],
resolve: {
alias: {
"@": resolve(import.meta.dirname, "src"),
},
},
server: {
port: PORT,
host: true,
},
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!