Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url vuejs历史模式路由_Url_Vue.js_Url Rewriting_Vuejs2_Vue Router - Fatal编程技术网

Url vuejs历史模式路由

Url vuejs历史模式路由,url,vue.js,url-rewriting,vuejs2,vue-router,Url,Vue.js,Url Rewriting,Vuejs2,Vue Router,如何使用历史记录模式路由到更长的URL路径 示例:/catalog/[product name]/p/[product id] 当历史模式打开时,站点将变为空白。 在我的CSS和JS上出现以下类型的错误 拒绝执行来自“{URL}/catalog/[product name]/p/dist/build.js”的脚本,因为它的MIME类型为 ('text/html')不可执行,并且需要严格的MIME类型检查 启用 路由器代码: const router = new VueRouter({ mod

如何使用历史记录模式路由到更长的URL路径

示例
/catalog/[product name]/p/[product id]

当历史模式打开时,站点将变为空白。 在我的CSS和JS上出现以下类型的错误

拒绝执行来自“{URL}/catalog/[product name]/p/dist/build.js”的脚本,因为它的MIME类型为 ('text/html')不可执行,并且需要严格的MIME类型检查 启用

路由器代码:

const router = new VueRouter({
  mode: 'history',
  routes: [
    { path: '/catalog/my-product-name/p/MASN123U', name: 'product', component: product }
  ]
})
旁注: 它在没有历史记录模式的情况下运行良好,只是URL读取

/#/catalog/[product name]/p/[product id]

Web.config与文档一致


`在这里输入代码`
来自错误:

拒绝执行来自“{URL}/catalog/[product name]/p/dist/build.js”的脚本,因为它的MIME类型(“text/html”)不可执行,并且启用了严格的MIME类型检查

查看HTML文件中的某个地方,您可能有这样一个脚本标记:


当其路径应为绝对路径时,如:



请注意在
dist

之前添加的
/
显示服务器端配置(url重写?)。您在那里遇到了一个问题。@acdcjunior添加了一个。
/
而不是
/
。掌纹