Vue 修改默认访问地址


一、修改Vue配置文件

       ①、修改Vue.config.js配置,修改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,并修改action节点、url属性

<?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>

        ③、安装IISRewrite


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM