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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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.5k
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
20260320登壇資料
pharct
0
160
Feature Toggle は捨てやすく使おう
gennei
0
410
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
950
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.8k
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
240
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
230
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
180
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
430
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
300
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
160
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
140
Go_College_最終発表資料__外部公開用_.pdf
xe_pc23
0
120
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
320
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Technical Leadership for Architectural Decision Making
baasie
3
310
Mind Mapping
helmedeiros
PRO
1
140
Ethics towards AI in product and experience design
skipperchong
2
250
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Design in an AI World
tapps
0
190
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
230
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
サーバーの動作はカスタマイズ可能 外れすぎない範囲で使うのが良さそう