修复再来一单问题

This commit is contained in:
2025-12-16 17:00:32 +08:00
parent 251490e3ab
commit 645122c182
9 changed files with 170 additions and 84 deletions

View File

@@ -1,42 +1,43 @@
// vite.config.js正确的 CommonJS 配置)
const { defineConfig } = require("vite");
const {
defineConfig
} = require("vite");
const uni = require("@dcloudio/vite-plugin-uni").default; // uni 插件需要 .default
const AutoImport = require("unplugin-auto-import/vite"); // 旧版本 AutoImport 直接导出函数,无需 .default
module.exports = defineConfig({
plugins: [
uni(),
AutoImport({
include: [/\.js$/, /\.vue$/, /\.vue\?vue/],
imports: [
"vue",
{
"@dcloudio/uni-app": [
"onLoad",
"onShow",
"onHide",
"onUnload",
"onReady",
"onReachBottom",
"onPageScroll",
"uni.request",
"uni.navigateTo",
"uni.showToast",
],
},
],
dts: "src/auto-imports.d.ts",
}),
],
server: {
hmr: true,
proxy: {
"/api": {
target: "http://192.168.1.42",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
secure: false,
},
},
},
});
plugins: [
uni(),
AutoImport({
include: [/\.js$/, /\.vue$/, /\.vue\?vue/],
imports: [
"vue",
{
"@dcloudio/uni-app": [
"onLoad",
"onShow",
"onHide",
"onUnload",
"onReady",
"onReachBottom",
"onPageScroll",
"uni.request",
"uni.navigateTo",
"uni.showToast",
],
},
],
dts: "src/auto-imports.d.ts",
}),
],
server: {
proxy: {
'/api': {
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
target: 'http://192.168.1.42/', // 目标服务器地址
changeOrigin: true, // 是否更改请求源
rewrite: path => path.replace(/^\/api/, '')
},
},
},
});