1 Star 0 Fork 0

nicefree/vue-ssr3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
nuxt.config.js 2.62 KB
一键复制 编辑 原始数据 按行查看 历史
nicefree 提交于 2021-12-15 00:06 . add
export default {
// Global page headers (https://go.nuxtjs.dev/config-head)
head: {
title: process.env.npm_package_name || '统一标题',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '自定义的描述信息' }
],
/* script: [
{src: 'http://code.jquery.com/jquery-2.1.1.min.js'}
], */
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
/* { rel: 'stylesheet', href: 'https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/1.4.0/css/bootstrap.min.css' } */
]
},
router: {
middleware: 'auth',
// 扩展路由
extendRoutes(routes, resolve) {
console.log(routes)
routes.push({
name: 'home',
path: '/index',
component: resolve(__dirname, 'pages/index.vue')
})
}
},
/**
* 定义系统默认loading效果, 或者指定一loading组件
*/
/* loading: {
color: '#399', height: '3px'
}, */
loading: '~/components/loading.vue',
// Global CSS (https://go.nuxtjs.dev/config-css)
css: [
'assets/css/transition.css',
'element-ui/lib/theme-chalk/index.css',
'assets/css/base.css'
],
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
plugins: [
'~/plugins/router',
{
src: '~/plugins/axios',
ssr: true, // 服务端渲染
},
{
src: '~/plugins/element-ui',
ssr: true
},
'~/plugins/mixins'
],
// Auto import components (https://go.nuxtjs.dev/config-components)
components: true,
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
buildModules: [
],
// Modules (https://go.nuxtjs.dev/config-modules)
modules: [
// https://go.nuxtjs.dev/axios
'@nuxtjs/axios',
'cookie-universal-nuxt',
'@nuxtjs/style-resources'
],
styleResources: {
scss: [
'./assets/scss/global.scss'
]
},
// Axios module configuration (https://go.nuxtjs.dev/config-axios)
axios: {
proxy: true, // 开启axios跨域
// profix: '/api', // baseUrl
},
proxy: {
'/api': {
target: 'http:///localhost:3001', // 代理转发的地址
changeOrigin: true,
pathRewrite: {
// '^/api': ''
}
}
},
// Build Configuration (https://go.nuxtjs.dev/config-build)
build: {
transpile: [/^element-ui/],
/**
* You can extend webpack config here
*/
extend (config, ctx) {
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/nicefree/vue-ssr3.git
git@gitee.com:nicefree/vue-ssr3.git
nicefree
vue-ssr3
vue-ssr3
master

搜索帮助