Vue 修改默认访问地址

一、修改Vue配置文件

       ①、修改配置,修改publicPath节点即可,对应修改访问地址

/*
* vue config
* */
const fs = require('fs-extra')
module.exports = {
  lintOnSave: false,
  publicPath: '/RtcScreen/',
  devServer: {
    port: 8020,
    overlay: {
      warnings: false,
      errors: true
    },
    https: true,
    key: fs.readFileSync('./cert/key.pem'),
    cert: fs.readFileSync('./cert/cert.pem'),
    openPage: '#/?path=screenShare'
  },
  configureWebpack: config => {
    if (process.env.NODE_ENV === 'development') {
      config.devtool = 'eval-source-map'
    }
  }
}

      ②、添加web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Handle History Mode and custom 404/500" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="/RtcScreen/" /> <!--这里对应修改访问地址-->
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

 

上一篇:AtCoder Beginner Contest 043 题解


下一篇:基于STM32 HAL库的自定义USB HID设备通信