vue.js脚手架项目-地址栏:http://localhost:8080/?#/中的?号哪里来的

地址栏中的?号影响体验,想去掉。之前也是一样的步骤,在运行其他项目时没有出现,偏偏这个就出现,谢谢各位大神

在route/index.js文件中找到routes节点,在该节点上面同级定义
mode: 'history',
这样,路由模式就变成了我们所熟悉的/A/B/C这种形式而没有#在中间;
如果项目部署在IIS,还需要在根目录添加一个web.config文件,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="default" patternSyntax="Wildcard">
                    <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/index.html" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

当然,如果IIS没有安装URL Rewrite插件,需要去安装一下。