Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初始定位到一个不存在的锚点会无法正确初始化 #42

Closed
hightman opened this issue Jun 22, 2016 · 3 comments
Closed

初始定位到一个不存在的锚点会无法正确初始化 #42

hightman opened this issue Jun 22, 2016 · 3 comments

Comments

@hightman
Copy link

比如一打开浏览器就访问 demo 中的如下网址
http://zhaoda.net/spa/docs/#faint

那么页面永远无法完成初始化。实际场景中我是希望正常打开一个服务端渲染的页面(因为此页面通常较大),在此基础上使用 spa 管理 hash 跳转。

@hightman
Copy link
Author

顺便补充个情况,如果初如页面就带入 hash,由于 title 的设置代码在 :navigate 事件中,会导致标题无法生效,是否可以考虑把修改 title 的代码移到 :openpage 中去。

@zhaoda
Copy link
Owner

zhaoda commented Aug 16, 2016

@hightman 关于404页面的问题,这个很好解决,只要增加一个以*开头的路由的页面做成404提示页面就可以了,我在 ~/docs 中增加了这个demo支持,你可以点你上面的链接试试看,路由代码如下。

// 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])
    })
  }
}

@zhaoda
Copy link
Owner

zhaoda commented Aug 16, 2016

@hightman 关于修改标题,你在桌面浏览器中查看 docs 的用例页面,标题是可以修改了,如果是微信这样的 webview ,可能标题的修改就要做一些 hack 了,参考 https://github.com/zhaoda/spa/blob/master/src/spa.js#L1920

@zhaoda zhaoda closed this as completed Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants