zoukankan      html  css  js  c++  java
  • 【vue】vue.config.js

    const goods = require('./data/goods.json');
    const ratings = require('./data/ratings.json');
    const seller = require('./data/seller.json');

    module.exports = {
    publicPath: './', //输出的根路径 默认是/ 如果你的网站是app.com/vue 这更改此配置项
    outputDir: 'dist',//构建输出目录
    assetsDir: 'assets',//静态资源目录(js,css,img,fonts)
    lintOnSave: false,//是否开启eslint保存检测,有效值:ture||false||'error'

    devServer: {
    open: true, //开启浏览器
    host: 'localhost',
    port: 8081,
    https: false,
    hotOnly: false,
    proxy: {//配置跨域
    '/api': {
    target: "http//localhost:5000/api/",
    ws: true,//是否跨域
    changOrigin: true,//配置跨域
    pathRewrite: {//重定向
    '^/api': ''
    }
    }
    },
    before(app) {// http://localhost:8081/api/goods
    app.get('/api/goods',(req,res) => {
    res.json(goods);
    })
    app.get('/api/ratings',(req,res) => {
    res.json(ratings);
    })
    app.get('/api/seller',(req,res) => {
    res.json(seller);
    })
    }
    }
    }
  • 相关阅读:
    委托事件
    泛型
    栈和队列
    泛型
    枚举与位枚举
    数组 集合
    .NET Framework 简介
    三行代码 完美解决word标签文字替换 POI增强版 可插入图片
    Github国内镜像网站,解决Github访问的神器
    Eureka
  • 原文地址:https://www.cnblogs.com/kevinmajesty/p/10648062.html
Copyright © 2011-2022 走看看