vue.js - 加载在子页面上的 Vue 应用程序的 URL 将更新为站点起始页
问题描述
我正在尝试在我的一个子页面上加载 Vue 应用程序。该站点是在 IIS 上运行 ASP .NET 的 Episerver CMS 站点。
当尝试在我的一个子页面上加载我的 Vue 应用程序时,该 url 更改为我的起始页 url。该应用程序工作正常,但由于 url 已更改,应用程序在页面刷新时中断。
我正在使用具有哈希模式的 Vue 路由器(需要哈希模式。使用历史模式时一切正常)。
假设我的应用程序加载到以下 url:
https://www.example.com/subpage/appstart/
我的路线配置:
{
mode: 'hash',
base: '/',
[
{
path: '/',
name: 'home',
component: Home
},
{
path: '/page1',
name: 'page1',
component: Page
},
],
}
我尝试使用 '/subpage/appstart/' 作为基础,但在使用哈希模式时似乎没有任何效果?
导航到我的应用程序时:
https://www.example.com/subpage/appstart/
网址改为:
应用程序有效,路由也有效。导航到其中一个页面最终将使用以下 url:
https://www.example.com/#/page1
如何使应用程序从正确的根 url 工作,以便我的应用程序主页保持在正确的 url 上:
解决方案
推荐阅读
- joomla - 有什么方法可以手动将 Joomla 中的新注册用户发送到 Mautic?
- javascript - 如何使用 JavaScript append 插入带有样式属性的选项值?
- mysql - 有没有办法通过更改连接点来运行带有 MySql 数据库的 DNN 9?
- java - 从我的所有控制器访问一个变量
- c++ - 采用 Eigen::Tensor 的函数 - 模板参数推导失败
- python - Insert SQLalchemy from dictionary
- algorithm - 计算 3D 固定关节约束中两个实体的冲量/扭矩
- linux - 如何使用由无人用户启动的 JProfiler for JVM 远程配置文件?
- node.js - 使用 Bluebird Promise.map 并发参数来加速 CouchDBs 上的查询
- c# - 如何将 SuggestedActions 作为列表而不是轮播