重构: 应用代码移入 internal/app 包,根目录只留入口
根目录原 7 个 app*.go 平铺,现收进 internal/app/ 子包: - package main → package app - NewApp → New(导出) - startup/shutdown → Startup/Shutdown(导出,供 main.go 引用) - main.go 改为薄入口,仅导入 internal/app 并装配 Wails 前端同步更新(Wails 绑定路径 go/main → go/app): - window.go.main.App → window.go.app.App(10 处) - env.d.ts 类型声明路径 wailsjs/go/main/App → wailsjs/go/app/App 根目录 Go 文件从 7 个减至 1 个(main.go),元文件更清晰
This commit is contained in:
@@ -13,7 +13,7 @@ export interface AccountStatus {
|
||||
message?: string
|
||||
}
|
||||
|
||||
const App = window.go.main.App
|
||||
const App = window.go.app.App
|
||||
|
||||
const accounts = ref<Account[]>([])
|
||||
const selectedIndices = ref<Set<number>>(new Set())
|
||||
|
||||
@@ -12,8 +12,8 @@ const activities = ref<ActivityItem[]>([])
|
||||
const currentActivity = ref<ActivityItem | null>(null)
|
||||
const switching = ref(false)
|
||||
|
||||
// 与项目其他 composable 一致,直接走 Wails 运行时注入的 window.go.main.App
|
||||
const App = window.go.main.App
|
||||
// 与项目其他 composable 一致,直接走 Wails 运行时注入的 window.go.app.App
|
||||
const App = window.go.app.App
|
||||
|
||||
export function useActivity() {
|
||||
const { showToast } = useToast()
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface LogMessage {
|
||||
source: 'local' | 'server'
|
||||
}
|
||||
|
||||
const App = window.go.main.App
|
||||
const App = window.go.app.App
|
||||
|
||||
const logs = ref<LogMessage[]>([])
|
||||
const results = ref<Record<string, string>>({})
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface ProductPayload {
|
||||
stale: boolean
|
||||
}
|
||||
|
||||
const App = window.go.main.App
|
||||
const App = window.go.app.App
|
||||
|
||||
const products = ref<Product[]>([])
|
||||
const productInfo = ref<ProductPayload | null>(null)
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useAccounts } from './useAccounts'
|
||||
import { useProducts } from './useProducts'
|
||||
import { useLogs } from './useLogs'
|
||||
|
||||
const App = window.go.main.App
|
||||
const App = window.go.app.App
|
||||
|
||||
const scheduleActive = ref(false)
|
||||
const countdownSeconds = ref(0)
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface Settings {
|
||||
seckillMode: number // 0=标准, 1=激进
|
||||
}
|
||||
|
||||
const App = window.go.main.App
|
||||
const App = window.go.app.App
|
||||
|
||||
const defaultRetryStages: RetryStage[] = [
|
||||
{ maxElapsed: 4, interval: 120 },
|
||||
|
||||
Reference in New Issue
Block a user