$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Nuxt.jsが掲げる"Universal Vue.js Applications"とは何者か
Search
Yosuke Ishikawa
October 04, 2017
Programming
10
2.8k
Nuxt.jsが掲げる"Universal Vue.js Applications"とは何者か
Yosuke Ishikawa
October 04, 2017
Tweet
Share
More Decks by Yosuke Ishikawa
See All by Yosuke Ishikawa
効率的な開発手段として VRTを活用する
ishkawa
1
210
アプリを起動せずにアプリを開発して品質と生産性を上げる
ishkawa
0
4.3k
Achieving Testability in Presentation Layer
ishkawa
4
3.8k
Introducing Wire: Dependency Injection by Code Generator
ishkawa
12
1.3k
Declarative UICollectionView
ishkawa
28
8.3k
Static Dependency Injection by Code Generation
ishkawa
15
6.6k
実践クライアントサイドSwift
ishkawa
24
4.3k
JSON-RPC on APIKit
ishkawa
5
63k
RxSwiftは開発をどう変えたか?
ishkawa
12
4k
Other Decks in Programming
See All in Programming
エディターってAIで操作できるんだぜ
kis9a
0
670
dnx で実行できるコマンド、作ってみました
tomohisa
0
140
Integrating WordPress and Symfony
alexandresalome
0
130
TypeScriptで設計する 堅牢さとUXを両立した非同期ワークフローの実現
moeka__c
6
2.9k
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
140
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
8
19k
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
18
7k
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
320
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
140
ゲームの物理 剛体編
fadis
0
280
チームをチームにするEM
hitode909
0
250
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
330
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Agile that works and the tools we love
rasmusluckow
331
21k
Building Applications with DynamoDB
mza
96
6.8k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Facilitating Awesome Meetings
lara
57
6.7k
RailsConf 2023
tenderlove
30
1.3k
We Have a Design System, Now What?
morganepeng
54
7.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Transcript
Nuxt.js が掲げる "Universal Vue.js Applications" とは何者か
None
None
None
Universal Mode SPA Mode
Universal Mode ← こっち SPA Mode
None
None
わかるようでわからない
でも、使ってみたら理解できた
None
None
None
デベロッパーは1 つの Nuxt.js アプリ( ≒ Vue.js アプリ) を 開発するが...
SSR するサーバーも生成される
"Universal Vue.js Applications"
そういう感じか~
Vue.js のアプリと 生成されるサーバーの関係は?
例 ディレクトリ構造 → ルーティングに反映 asyncData() → サーバーサイドで実行
ルーティング
pages ├── index.vue └── items ├── _id.vue ├── create │
└── index.vue └── index.vue Nuxt.js アプリのディレクトリ構造
export function createRouter () { return new Router({ mode: 'history',
base: '/', (中略) routes: [ {path: "/", component: _d26d9516, name: " {path: "/items", component: _8ac95cea, nam {path: "/items/create", component: _4bfc3 {path: "/items/:id", component: _07563ab3 ] }) } 生成されたサーバーのルーティング
asyncData()
asyncData() 最初に取得するデータをSSR
... <script> export default { async asyncData ({ app })
{ const res = await app.axios.$get('/api/item return { items: res.items, nextCursor: res.nextCursor, } } } </script> Nuxt.js アプリの.vue ファイル
let asyncDatas = await Promise.all(Components.m let promises = [] if
(Component.options.asyncData && typeof Com let promise = promisify(Component.options.a (中略) promises.push(promise) } (中略) return Promise.all(promises) })) context.nuxt.data = asyncDatas.map(r => r[0] || で実行してdata にセット
要するに
Vue.js アプリを書いてたら SSR するサーバーが生成される
None
サーバーはNode.js
サーバーの動作はカスタマイズ可能 外れすぎない範囲で使うのが良さそう