我正在编写一些 Javascript,我需要添加一个路由系统,否则随着列表的增长管理起来会很棘手。
Angular 路由很好,但我不想将其添加为依赖项。有哪些选择?
if(window.location.pathname==='/') {
var $btn = $('<a />').html('btn').click(function() {
$questionList.html(findAnswers());
});
$tabs.prepend($btn);
}
if(window.location.pathname==='/posts') {
// some code will run when only on post page
}
最佳答案
关于javascript - 客户端 Javascript 的类似 Express 的路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29998179/