工作随笔——ember框架去除url上的#号

因为工作原因,接触到了一套非常好的前端框架--ember。

ember框架高度封装,学习曲线比较陡峭。

ember对于url更新的配置在config/environment.js >> locationType上。

locationType有4种模式:

  • history:使用html5的history API(url中没有#号)
  • hash:使用锚点的url方式(url中会存在/#/xxxx这种路径,会影响浏览器解析页面的锚点)
  • auto:优先尝试history模式
  • none:不更新url

根据以上规则,去除rul中的#号,应该使用history模式。

 

ember有一个锚点插件(仅支持chrome浏览器)

https://www.npmjs.com/package/ember-anchor

 

参考资料:

https://guides.emberjs.com/v2.0.0/configuring-ember/specifying-url-type/ 

posted @ 2017-02-24 12:33  爱自己  阅读(305)  评论(0编辑  收藏  举报