【发布时间】:2020-07-01 15:24:23
【问题描述】:
vaadin-router 是一个小型客户端 javascript 路由器。如何交付任意数量的静态 html 页面?
【问题讨论】:
vaadin-router 是一个小型客户端 javascript 路由器。如何交付任意数量的静态 html 页面?
【问题讨论】:
demo 包含如何将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;
}
}
【讨论】: