美文网首页
history路由模式时,页面空白

history路由模式时,页面空白

作者: 爱笑的小白菜 | 来源:发表于2019-01-18 10:18 被阅读0次

history路由模式时,config目录下的index.js文件里的build: { assetsPublicPath: '/',   }  只能设置为“/”,不能设置为“./”,,,,但是这样设置页面访问依然会出现空白,,,这时只要在服务器的存放代码的dist目录下 加上  web.config文件配置就行啦。

 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="/index.html" />

        </rule>

      </rules>

    </rewrite>

  </system.webServer>

</configuration>

相关文章

网友评论

      本文标题:history路由模式时,页面空白

      本文链接:https://www.haomeiwen.com/subject/cybgdqtx.html