Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AruchSummit2014 - 去哪儿SPA分享
Search
破锣锅
December 22, 2014
Technology
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AruchSummit2014 - 去哪儿SPA分享
破锣锅
December 22, 2014
More Decks by 破锣锅
See All by 破锣锅
NodeJS 应用以及线上服务的运维和监控
paulguo
2
440
AruchSummit2014 - 手机QQ的移动化实践之路
paulguo
0
350
AruchSummit2014 -
paulguo
0
260
AruchSummit2014 - The Impact Of A Compact Web
paulguo
0
210
Gulp vs Grunt
paulguo
0
6.3k
HTML5简介及移动端Web开发调试工具
paulguo
7
690
Mobile Web 开发实战
paulguo
3
290
H5 Mobile 开发调试实践
paulguo
7
1.1k
HTML5 Intro For QA
paulguo
1
240
Other Decks in Technology
See All in Technology
世界、断片、モデル。そして理解
ardbeg1958
1
130
LLMやAIエージェントをソフトウェアに組み込むプラクティス
shibuiwilliam
2
390
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
110k
生成AI×AWS CDK×AWS FISで"振り返れる"ミニGameDayをつくろう
yoshimi0227
1
230
DMM.com 購入改善推進チーム におけるCodeRabbitを用いた レビューフロー改善の一例
ysknsid25
2
640
CDKで書くECSのベストプラクティス、 改めて考え直す2026 #cdkconf2026
makies
1
570
ゴールデンパスは敷いただけでは道にならない ─ 企画部門のエンジニアが技術標準を事業価値に変えるまで
mhrtech
1
170
CIで使うClaude
iwatatomoya
0
280
Empower GenAI with Agile - あなたのアジャイルが生成AIのバフになる仕組み
hageyahhoo
1
210
Devsumi 2026 Summer 人もAIも使える共通基盤を事業の加速装置にする~デザインシステム運用に学ぶ組織レバレッジ~ 渡辺 凌央
legalontechnologies
PRO
1
170
10年目を迎えた「ABEMA」がどのように AI 活用を推進して、AI 駆動開発にシフトしているのか / How ABEMA, entering its 10th year, is promoting the use of AI and shifting toward AI-driven development
miyukki
0
160
最適な自走を最小限の支援で — M&Aで拡大する組織で少人数SREが挑んだ1年 / SRE NEXT 2026
genda
0
1.3k
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
330
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Prompt Engineering for Job Search
mfonobong
0
370
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.6k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Limits of Empathy - UXLibs8
cassininazir
1
480
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.4k
Facilitating Awesome Meetings
lara
57
7k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
First, design no harm
axbom
PRO
2
1.2k
Transcript
去哪⼉儿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 问题 ✓ 复杂的交互体验仍然有性能瓶颈 ✓ 设备差异导致体验很难⼀一致
谢谢