{"action":"closed","issue":{"url":"https://api.github.com/repos/vuejs/vue-router/issues/470","repository_url":"https://api.github.com/repos/vuejs/vue-router","labels_url":"https://api.github.com/repos/vuejs/vue-router/issues/470/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue-router/issues/470/comments","events_url":"https://api.github.com/repos/vuejs/vue-router/issues/470/events","html_url":"https://github.com/vuejs/vue-router/issues/470","id":149517567,"number":470,"title":"粘贴地址访问，设置验证无效","user":{"login":"ickeep","id":9164133,"avatar_url":"https://avatars.githubusercontent.com/u/9164133?v=3","gravatar_id":"","url":"https://api.github.com/users/ickeep","html_url":"https://github.com/ickeep","followers_url":"https://api.github.com/users/ickeep/followers","following_url":"https://api.github.com/users/ickeep/following{/other_user}","gists_url":"https://api.github.com/users/ickeep/gists{/gist_id}","starred_url":"https://api.github.com/users/ickeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ickeep/subscriptions","organizations_url":"https://api.github.com/users/ickeep/orgs","repos_url":"https://api.github.com/users/ickeep/repos","events_url":"https://api.github.com/users/ickeep/events{/privacy}","received_events_url":"https://api.github.com/users/ickeep/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-19T16:49:55Z","updated_at":"2016-04-20T14:36:45Z","closed_at":"2016-04-20T14:36:45Z","body":"根据官方文档，给路由添加\r\n```\r\n \"/my\": {\r\n    component: My,\r\n    auth: true\r\n  },\r\n\r\n```\r\n并且\r\n\r\n```\r\nrouter.start(app, '#app');\r\n\r\nrouter.beforeEach(function (transition) {\r\n  if (transition.to.auth) {\r\n    getUserInfo().then(function (user) {\r\n      if (!user.id) {\r\n        router.replace(\"/login\")\r\n      }\r\n    });\r\n  } else {\r\n    transition.next()\r\n  }\r\n});\r\n```\r\n在页面点击链接跳转，会重定向至/login\r\n当直接复制  http://domin.com/my or http://xxx.com/!#/my 时 页面直接渲染，并不会进行验证？\r\n\r\n路由配置 \r\n`var router = new VueRouter({\r\n  history: true, //true false 均无效\r\n  saveScrollPosition: true //记住页面的滚动位置 html5模式适用\r\n});`\r\n\r\n相关版本号\r\n```\r\n   \"vue\": \"^1.0.21\",\r\n    \"vue-async-data\": \"^1.0.2\",\r\n    \"vue-hot-reload-api\": \"^1.3.2\",\r\n    \"vue-html-loader\": \"^1.2.2\",\r\n    \"vue-loader\": \"^8.2.2\",\r\n    \"vue-resource\": \"^0.7.0\",\r\n    \"vue-router\": \"^0.7.13\",\r\n    \"vue-style-loader\": \"^1.0.0\",\r\n    \"vue-validator\": \"^2.0.1\"\r\n```"}}