找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 查看内容

vue.js怎么改端口号

作者:模板之家 2020-11-10 18:11 71人关注

vue.js更改端口号的方法:1、config文件夹中有一个【index.js】其中部分内容如下,port即为端口号,在这里更改;2、【Vue 3.x】中修改端口号则需要在项目根目录下创建一个【vue.config.js】。

vue.js更改端口号的方法:1、config文件夹中有一个【index.js】其中部分内容如下,port即为端口号,在这里更改;2、【Vue 3.x】中修改端口号则需要在项目根目录下创建一个【vue.config.js】。

【相关文章推荐:vue.js】

vue.js更改端口号的方法:

1.Vue 2.x

config文件夹中有一个index.js其中部分内容如下,port即为端口号,在这里更改即可。

module.exports = {
  dev: {
    env: require('./dev.env'),
    port: 8080,  // 端口号
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {},
    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false,
   }
};

2.Vue 3.x

Vue 3.x中修改端口号则需要在项目根目录下创建一个vue.config.js,内容如下。

module.exports = {
  devServer: {
    port: 8080,   // 端口号
  }
};

相关免费学习推荐:JavaScript(视频)

以上就是vue.js怎么改端口号的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章!


路过

雷人

握手

鲜花

鸡蛋
来自: 网络收集

全部回复(0)