vue.js - Nuxt.js 中 URL 的哈希值
问题描述
路由器模式是“历史”,我想验证中间件中的每个请求,当请求无效时,它将请求重定向到给定页面。就我而言,white_path 中不存在的请求将被重定向到“/500”:
export default function (context) {
const white_path = new Array('/login', '/404', '/500')
const cur_path = context.route.path
if(white_path.indexOf(cur_path) < 0){
context.redirect(301, '/500')
}
}
但问题是,当我输入网址时:http://localhost:3000/blog/SampleTitle/#first-paragraph,但随后它重定向到http://localhost:3000/500#first-paragraph。为什么哈希值不会消失?在中间件中,hash 值为空,但是重定向到客户端后,hash 值变成了出现在最后一个 url 中的那个。
我该如何解决?非常感谢您!
解决方案
推荐阅读
- google-apps-script - 在 GAS 中调用工作表函数
- python - 如何阻止 Kivy 在 RecycleView 中自动选择模数项?
- arrays - 在 Swift 中的 for 循环中存储新数组
- python - 如何在python中的字典中搜索多个值?
- reactjs - 如何在 reactJS 环境中查找、添加、删除 MongoDB 中的数据库条目
- oracle - oracle 中的多个 SID
- sql - 获得在sql中完成的所有计数总和的正确方法
- ruby-on-rails - RAILS - 强制在 ActiveRecord 模型中用于 .save 和 .update 的条件
- laravel - 在 Laravel 中找不到验证请求类
- javascript - 使用引导程序设置我的导航栏及其子项的链接