详细请查看 链接: https://www.cnblogs.com/laozhang-is-phi/p/10249248.html#autoid-7-0-0.
包括创建开始到结束的旅程
从Github上下载下来之后发现在代理出现错误
之后便是经过千辛万苦到网上淘来了正确的代理本地代理方式
const webpack = require('webpack')
module.exports = {
mode: 'universal',
/*
** 页面头信息
*/
head: {
title: 'tBug,一个专业的解决bug平台',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'keywords', content: 'tbug博客,.netcore,vue,ddd,sqlsugar,web开发,前后端分离,nuxt' },
{ hid: 'description', name: 'description', content: 'tbug博客,.netcore,vue,ddd,sqlsugar,web开发,前后端分离,nuxt' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** 自定义加载条的样式
*/
loading: { color: '#44C1B8', height: '4px' },
vender:[
'element-ui', 'axios', '~untils/index.js'
],
/*
** 全局CSS
*/
css: [
'element-ui/lib/theme-chalk/index.css',
{ src: "mavon-editor/dist/css/index.css" },
{src: '@/style/style.css', lang: 'css'}
],
/*
** 在安装app之前,加载插件
*/
plugins: [
{ src: '~plugins/element-ui', ssr: true },
{ src: '~plugins/nuxt-markdown.js',ssr: false },
{ src: "~plugins/server_site/index", ssr: false }
],
/*
** Nuxt.js modules
*/
/*
** Axios module configuration
*/
/*
** Build configuration
*/
build: {
build: {
vendor: ['element-ui', 'axios', 'Button', 'Input', 'Tabs', 'Message', 'TabPane', 'Row', 'Col', 'Loading', 'Notification', 'Icon']
},
analyze: false,
plugins: [
new webpack.ContextReplacementPlugin(
/highlight\.js\/lib\/languages$/,
new RegExp(`^./(${['javascript', 'css', 'php', 'sql', 'python', 'bash'].join('|')})$`),
)
],
babel: {
},
/*
** Run ESLint on save
*/
extend(config, ctx) {
},
},
modules: [
// Doc: https://github.com/nuxt-community/axios-module#usage
'@nuxtjs/axios',
],
axios: {
proxy: true,
prefix: '/api', // baseURL
credentials: true,
},
proxy: {
'/api/': {
target: 'https://m.hzqcjt.com', // 代理地址
changeOrigin: true,
pathRewrite: {
'^/api': ''
},
},
}
}