diff --git a/FrontEnd/SPA/README.md b/FrontEnd/SPA/README.md index 1511959..004a4ac 100644 --- a/FrontEnd/SPA/README.md +++ b/FrontEnd/SPA/README.md @@ -1,5 +1,129 @@ -# Vue 3 + Vite - -This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 ` + + diff --git a/FrontEnd/SPA/src/utils/request.ts b/FrontEnd/SPA/src/utils/request.ts index e574e72..dfcfb8e 100644 --- a/FrontEnd/SPA/src/utils/request.ts +++ b/FrontEnd/SPA/src/utils/request.ts @@ -1,7 +1,7 @@ import axios from 'axios' const request = axios.create({ - baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/api', // 后端API地址 + baseURL: import.meta.env.VITE_API_BASE_URL || 'http://127.0.0.1:4523/m1/8175900-7935055-default/api', // 后端API地址 timeout: 30000, }) diff --git a/FrontEnd/SPA/tsconfig.json b/FrontEnd/SPA/tsconfig.json index d326786..36bd316 100644 --- a/FrontEnd/SPA/tsconfig.json +++ b/FrontEnd/SPA/tsconfig.json @@ -1,4 +1,4 @@ -{ +{ "compilerOptions": { "target": "ES2020", "module": "ESNext", @@ -9,7 +9,8 @@ "isolatedModules": true, "esModuleInterop": true, "lib": ["ES2020", "DOM", "DOM.Iterable"], - "types": ["vite/client"] + "types": ["vite/client", "node"], + "skipLibCheck": true }, "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] } diff --git a/FrontEnd/SPA/vite.config.js b/FrontEnd/SPA/vite.config.js index bbcf80c..1e60f98 100644 --- a/FrontEnd/SPA/vite.config.js +++ b/FrontEnd/SPA/vite.config.js @@ -3,5 +3,41 @@ import vue from '@vitejs/plugin-vue' // https://vite.dev/config/ export default defineConfig({ - plugins: [vue()], + plugins: [vue({ + template: { + compilerOptions: { + // 编译时节点转换,最可靠的注入方式 + nodeTransforms: [ + (node, context) => { + // 只处理元素节点 + if (node.type === 1 /* Element */) { + // 获取当前文件路径和节点位置 + const filePath = context.filename.replace(/\\/g, '/') + const line = node.loc.start.line + const column = node.loc.start.column + + // 构造属性值 + const sourceInfo = JSON.stringify({ + path: filePath, + line, + column + }) + + // 添加自定义属性 + node.props.push({ + type: 6 /* Attribute */, + name: 'data-source-loc', + value: { + type: 2 /* Text */, + content: sourceInfo, + loc: node.loc + }, + loc: node.loc + }) + } + } + ] + } + } + })], })