如何使用 vaadin 路由器(客户端)交付静态 html 页面?



>vaadin-router 是一个小型客户端 JavaScript 路由器。如何提供任意数量的静态 html 页面?

该演示包含一个示例,如何将router-ignore作为属性添加到链接

<a href="/users" router-ignore>Users</a>

以及如何将与特定通道匹配的所有文件作为特殊路由交付

的示例
// this would be the first route in the router config:
var specialRoute = 
{
path: '/external/(.*)',
action: (ctx, commands) => {
window.location.pathname = ctx.pathname;
}
};

因此,要通过路由器交付所有html文件,我们可以使用:

var routeStaticHtmlFiles = 
{
path: '(.*).html',
action: (ctx, commands) => {
window.location.pathname = ctx.pathname;
}
}

最新更新