我有一个主页视图和一个博客视图。
尝试使用<router-link>从Home视图跳转到博客视图中的特定部分。
这一节看起来像<section id="fundamentals" class="section">
在html中,我相信它的工作方式类似于<a href="/blog/#fundamentals">Jump to specific blog section</a>。
如何使用vue-路由器复制此功能?
我在vue-路由器文档中找到了这个例子:
const router = new VueRouter({
mode: 'history',
routes: [{
path: '/settings',
// You could also have named views at tho top
component: UserSettings,
children: [{
path: 'emails',
component: UserEmai
假设我希望在vue-路由器中创建一个AuthService来验证当前会话,然后再转到下一个路由,如下面的示例:
router.beforeEach(function ({ to, next }) {
if (to.path === '/auth-required') {
// return a Promise that resolves to true or false
return AuthService.isLoggedIn()
} else {
next()
}
})
在不使用JSON令牌(JWT)的情况下,Laravel5.1将
我在学vue。我通过npm安装vue-路由器安装vue-路由器.我注册了VueRouter,并在VueRouter实例中main.js文件中定义了url路径。创建关于组件和在app.vue文件中使用的组件。但这条路线在 url或中不起作用。我还试图从url中删除#标记。以下是源代码:
Main.js
import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import About from './components/Abou