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
730
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
あの日、見つかっていなかったらどうなっていたか
kazzpapa3
2
230
狙われているAPIの脆弱性!今こそ手をつけるべき根本的な対策とは?
nagix
0
140
Go初心者のクラウドエンジニアが、デプロイを通して旨味を知っていく話
ryudai
1
220
変更差分を読むために環境を整備しよう
pipepasta
1
380
Kiro CLI 入門 (ターミナルと CI で使う) | 目指せ Kiro マスター 03
inariku
PRO
2
160
「任されビリティ」で引き受けて「よしなりてぃ」に頼らず任せる / Accept tasks with "makasarebility" and hand them over without relying on "yoshinarily"
pauli
1
670
AIネイティブ組織の作り方。1人のPOとAIから始める、自社での実験
ama_ch
2
1k
長い仕事を任せる (Workflows、クラウドセッション、Kiro Web) | 目指せ Kiro マスター 10
inariku
PRO
3
210
Context != Context: One window, many lifecycles (AI Native DevCon, Nov 2026)
birgitta410
0
150
_マネジメントする人される人ナイト_2026__良いチームを作っていきたい_お気持ち_.pdf
xkxaxkx
0
630
ぼくのClaude Codeの使い方
falken
PRO
5
7.2k
20261113_JAWS_Osaka
takuyay0ne
0
530
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
490
Git: the NoSQL Database
bkeepers
PRO
433
67k
Building the Perfect Custom Keyboard
takai
2
960
Between Models and Reality
mayunak
4
580
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
350
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
540
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Building Adaptive Systems
keathley
44
3.3k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
900