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
Nuxt.jsが掲げる"Universal Vue.js Applications"とは何者か
Search
Yosuke Ishikawa
October 04, 2017
Programming
2.8k
10
Share
Nuxt.jsが掲げる"Universal Vue.js Applications"とは何者か
Yosuke Ishikawa
October 04, 2017
More Decks by Yosuke Ishikawa
See All by Yosuke Ishikawa
効率的な開発手段として VRTを活用する
ishkawa
1
240
アプリを起動せずにアプリを開発して品質と生産性を上げる
ishkawa
0
4.6k
Achieving Testability in Presentation Layer
ishkawa
4
3.9k
Introducing Wire: Dependency Injection by Code Generator
ishkawa
12
1.4k
Declarative UICollectionView
ishkawa
28
8.5k
Static Dependency Injection by Code Generation
ishkawa
15
6.7k
実践クライアントサイドSwift
ishkawa
24
4.4k
JSON-RPC on APIKit
ishkawa
5
67k
RxSwiftは開発をどう変えたか?
ishkawa
12
4.1k
Other Decks in Programming
See All in Programming
From Formal Specification to Property Based Test
ohbarye
0
630
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
360
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
2.5k
🦞OpenClaw works with AWS
licux
1
320
t *testing.T は どこからやってくるの?
otakakot
1
870
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
330
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
260
書き換えて学ぶTemporal #fukts
pirosikick
2
320
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
180
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
170
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
250
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
950
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.1k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
180
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
300
The Spectacular Lies of Maps
axbom
PRO
1
720
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Designing for Performance
lara
611
70k
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
サーバーの動作はカスタマイズ可能 外れすぎない範囲で使うのが良さそう