1.初始化前端项目
Nuxt3:搭建项目_nuxt3 项目搭建-CSDN博客、
2.配置代理
nuxt.config.ts
// https://nuxt.com/docs/api/configuration/nuxt-configexport default defineNuxtConfig({devtools: { enabled: true },modules: ["@element-plus/nuxt", "@pinia/nuxt", "@nuxt/ui"],css: ["element-plus/dist/index.css"],vite: {server: {proxy: {// 代理配置"/api": {//将接口开头路径为/api的接口 代理到targettarget: "http://localhost:8080",changeOrigin: true,},},},},plugins: ["~/plugins/element-plus.ts", "~/plugins/axios.ts"],
});