Skip to content

Commit

Permalink
修复bug;添加 404 demo
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoda committed Aug 16, 2016
1 parent cc91f70 commit 021bc77
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/spa-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@
viewData = panelOptions.view.call($panel, panelData)

if($.isPlainObject(viewData)) {
$panel.trigger('spa:initpanel', [$panel, viewData])
$doc.trigger('spa:initpanel', [$panel, viewData])
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion dist/spa-apis.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/spa.js
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@
viewData = panelOptions.view.call($panel, panelData)

if($.isPlainObject(viewData)) {
$panel.trigger('spa:initpanel', [$panel, viewData])
$doc.trigger('spa:initpanel', [$panel, viewData])
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion dist/spa.min.js

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion docs/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@ var demoTransitPage = {
}
}

$doc.trigger('spa:route', [pageHome, demoNewPage, demoTransitPage])
// demo:404
var notFoundPage = {
route: '*notfound',
classname: 'demo-notfound',
animate: 'default',
view: function() {
var $page = this
requirejs(['demo.notfound'], function(viewData) {
$doc.trigger('spa:initpage', [$page, viewData])
})
}
}

$doc.trigger('spa:route', [pageHome, demoNewPage, demoTransitPage, notFoundPage])

// demo:侧边栏菜单
var demoPanelSidemenu = {
Expand Down
22 changes: 22 additions & 0 deletions docs/demo.notfound.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
define({
title: 'SPA - 页面不存在',
body: '<nav class="navbar navbar-default navbar-static-top" role="navigation">\
<div class="navbar-header">\
<a class="navbar-brand" href="#demo/newpage">页面不存在</a>\
</div>\
<a href="#" class="btn btn-default navbar-btn btn-link pull-left"><span class="glyphicon glyphicon-chevron-left"></span></a>\
</nav>\
<div class="page-container-navbar">\
<div class="container">\
<div class="page-header"><h1>404</h1></div>\
<p>Page Not Found</p>\
<a href="#" class="btn btn-default">返回</a>\
</div>\
</div>\
',
init: function(pageData) {
var $view = this

$('.page-container-navbar', $view).trigger('spa:scroll')
}
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "spa.js",
"title": "SPA",
"version": "2.0.2",
"version": "2.0.3",
"description": "A webapp framework for routing control and view transitions",
"directories": {
"doc": "docs"
Expand Down
2 changes: 1 addition & 1 deletion src/spa.js
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@
viewData = panelOptions.view.call($panel, panelData)

if($.isPlainObject(viewData)) {
$panel.trigger('spa:initpanel', [$panel, viewData])
$doc.trigger('spa:initpanel', [$panel, viewData])
}
}
})
Expand Down

0 comments on commit 021bc77

Please sign in to comment.