Vue Router 显示来自 Created() 方法的 null

Vue Router shows null from the Created() method

我想通过组件的 created() 方法访问 Vue 路由器 this.$router。但是,它显示 Cannot read property '$router' of null 错误。看起来无法通过 created() 方法访问 Vue 路由器。还有其他选择吗?

created () {
  this.$router.push('/user')
}

使用In-Component Guards:

// this is inside your component
beforeRouteEnter (to, from, next) {
  next('/user');
},
created() {
  // ...
}