Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AruchSummit2014 - 去哪儿SPA分享
Search
破锣锅
December 22, 2014
Technology
320
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AruchSummit2014 - 去哪儿SPA分享
破锣锅
December 22, 2014
Transcript
21 slides
去哪⼉儿SPA分享 蔡欢 Qunar
NativeApp NativeApp的局限 ✓ 分平台开发维护,成本⾼高 ✓ 部署成本⾼高
3 WebApp解决⽅方案选型 ✓ 传统page2page ✓ pjax(pushState Ajax) ✓ SPA(SinglePageApplication)
SPA的优势: ✓ 实施部署、跨平台 ✓ 前端模板渲染,前后端完全分离,数据量 最⼩小 ✓ 视图切换和url路由 ✓ 最贴近于Native应⽤用的交互体验
SPA Native App Desktop App REST APIs Middleware Lib(s) Data
Store(s) HTML 数据 数据 数据
6 设计思路 ✓ 模块化开发 ✓ 视图切换、URL路由 ✓ 模板前端渲染 ✓ 响应式
✓ 浏览器及App内做功能扩充和体验差异 ✓ 开发环境及构建⼯工具
core jQuery underscore requirejs jQuery UI Backbone.js Require-text Gruntjs Compo
nents 本地化 组件化 模块化 ⾃自动化 ⼀一体化 ⻚页⾯面化 livereload jshint autoprefixer uglify cssmin htmlmin less urlrewrite imagemin imageembed mocha r.js Web App Module s … jquery.ui.qunar.citypicker jquery.ui.qunar.datepicker jquery.ui.qunar.message jquery.ui.qunar.dialog background $.addPressClass $.location utils $.cookie $.spin flight common hotel user webserver
模块化开发-Requirejs ✓ 编译时资源打包 ✓ 实现同步、异步加载⾃自由切换 ✓ js依赖处理 ✓ 代码的拆分及复⽤用、按需加载
9 example
视图切换、URL路由 ✓ Quickling技术切换视图 ✓ ⼆二次开发backbonejs的路由完成url hash 对querystring 参数的⽀支持 ✓ ⽀支持视图定位,url分享,⽀支持浏览器前
进后退、⻚页⾯面刷新等
11 example ✓ http://pad.qunar.com/ ✓ http://pad.qunar.com/#hotel ✓ http://pad.qunar.com/#hotel/list/city=%E5%8C%97%E4%BA %AC&cityUrl=beijing_city&keyword=&fromDate=2014-12-18&t oDate=2014-12-19&sortType=&orderBy=&location=
模板前端渲染-underscore ✓ 单⻚页的渲染都在前端完成,需要⼀一套简单⾼高 效的前端模版 ✓ 使⽤用underscore的template,简洁、⾼高效 ✓ 采⽤用inline compress,将模版⽂文件编译成单 个模块化的js⽂文件
✓ 模块可以和其他静态资源⼀一起做CDN部署
响应式设计-iconfont ✓ iconfont⽮矢量字体处理icon ✓ CSS控制图形外观 ✓ 兼容移动设备屏幕不同devicePixelRatio 展⽰示差异
14 example
开发构建环境-gruntjs ✓ 构建⼯工具,同时提供⼀一套⽅方便的开发环境 ✓ 插件式易于扩展,丰富的第三⽅方插件 ✓ ⾃自⼰己开发插件
less&autoprefixer&cssmin&uglify等 ✓ Less将CSS赋予了动态语⾔言特性 ✓ CSS预编译,⾃自动补全浏览器⼚厂商前缀 ✓ ⾃自动内联图标⽂文件到CSS⽂文件中,减少 HTTP请求
实现插件完成数据mock 输⼊入⺴⽹网址 匹配URL connect Require本地⽂文件 代理到其他地址 不代理
18 ✓ 对浏览器及App内WebView做体验差异化 ✓ 当运⾏行在App内WebView时候,通过 Native组件对WebApp做能⼒力扩充。
19 问题 ✓ 针对搜索引擎的SEO ✓ http://pad.qunar.com/#hotel/list/city=%E5%8C%97%E4%BA %AC&cityUrl=beijing_city&keyword=&fromDate=2014-12-18&toDat e=2014-12-19&sortType=&orderBy=&location= ✓ http://pad.qunar.com/#!hotel/list/city=%E5%8C%97%E4%BA
%AC&cityUrl=beijing_city&keyword=&fromDate=2014-12-18&toDat e=2014-12-19&sortType=&orderBy=&location=
20 问题 ✓ 复杂的交互体验仍然有性能瓶颈 ✓ 设备差异导致体验很难⼀一致
谢谢
More Decks by 破锣锅
See All by 破锣锅
NodeJS 应用以及线上服务的运维和监控
paulguo
2
440
AruchSummit2014 - 手机QQ的移动化实践之路
paulguo
0
380
AruchSummit2014 -
paulguo
0
260
AruchSummit2014 - The Impact Of A Compact Web
paulguo
0
220
Gulp vs Grunt
paulguo
0
6.3k
HTML5简介及移动端Web开发调试工具
paulguo
7
720
Mobile Web 开发实战
paulguo
3
290
H5 Mobile 开发调试实践
paulguo
7
1.1k
HTML5 Intro For QA
paulguo
1
250
Other Decks in Technology
See All in Technology
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
0
230
属人化したISMS運用をGitHubとAIで仕組み化した1年間の記録
sioncojp
4
2.6k
ラクスル会社紹介資料|エンジニア向け / RAKSUL Introduction for Engineers
raksulrecruiting
0
110
Context != Context: One window, many lifecycles (AI Native DevCon, Nov 2026)
birgitta410
0
140
Intro to Kiro (One agent, every surface) | Kiro: Zero to Hero 01
inariku
PRO
2
130
長い仕事を任せる (Workflows、クラウドセッション、Kiro Web) | 目指せ Kiro マスター 10
inariku
PRO
3
190
会社説明資料_最新版
demaecan
0
32k
契約書SaaSにAIエージェントを組み込む
sansantech
PRO
0
130
【Oracle AI SPOTLIGHT ウェビナー】【特別開催:日本語で解説!】Oracle AI World 2026 最新情報フィードバック
oracle4engineer
PRO
1
210
[NW-JAWS DAY]「うちのAWS、インターネット出られないんで」― AWS外の自社サービスをPrivateLinkでシュッと公開する方法
ykimi
2
360
Claude Codeで作ったアプリを安全に公開する/Built with Claude Japan 2026
yoshidashingo
0
250
SSFの現在地 ― CAEP/RISCからAI Identityへ
oidfj
0
440
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Mind Mapping
helmedeiros
1
440
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
430
How GitHub (no longer) Works
holman
316
150k
Practical Orchestrator
shlominoach
192
12k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
790
Git: the NoSQL Database
bkeepers
PRO
433
67k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Scaling GitHub
holman
464
140k