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
Vue Fes Japan
Search
takanorip
November 03, 2018
Programming
5
10k
Vue Fes Japan
takanorip
November 03, 2018
Tweet
Share
More Decks by takanorip
See All by takanorip
Webフォント選定の極意!フォントの基本から最新トレンドまで徹底解説
takanorip
5
740
効果的な管理画面を デザインをするために 避けるべき5つの罠
takanorip
14
6.7k
社内管理画面のデザインもプロダクトデザイン
takanorip
4
1.7k
早わかり W3C Community Group
takanorip
0
450
Ubieとアクセシビリティのこれからを考える
takanorip
0
410
2023年版 デザインシステム 技術選定の勘所 - フロントエンドカンファレンス沖縄
takanorip
2
3.7k
Astroで始める爆速個人サイト開発
takanorip
15
11k
後悔しないデザインシステムの始め方
takanorip
4
3.1k
デザインシステム運用とOKRの良い関係
takanorip
0
2k
Other Decks in Programming
See All in Programming
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
940
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
240
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
930
return文におけるstd::moveについて
onihusube
1
1.4k
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
情報漏洩させないための設計
kubotak
5
1.3k
良いユニットテストを書こう
mototakatsu
11
3.6k
asdf-ecspresso作って 友達が増えた話 / Fujiwara Tech Conference 2025
koluku
0
1.3k
HTML/CSS超絶浅い説明
yuki0329
0
190
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
Package Traits
ikesyo
1
200
VisionProで部屋の明るさを反映させるシェーダーを作った話
segur
0
100
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
350
Code Review Best Practice
trishagee
65
17k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Six Lessons from altMBA
skipperchong
27
3.6k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
How GitHub (no longer) Works
holman
312
140k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Transcript
The Good relation between Vue.js and Web Components To the
future Takanori Oki @Vue Fes Japan
Self Introduction • Takanori Oki (@takanorip) • Frontend Developer at
FOLIO Inc. • Use Nuxt.js/Vue.js, React, Polymer • A member of Polymer Japan • I love font and webfont
None
What are Web Components?
Web Components w 8FCඪ४ٕज़ͰɺΧϓηϧԽ͞Εͨ ίϯϙʔωϯτʢ෦ʣͷ࠶ར༻ΛՄೳʹ ͢Δ֓೦ w 8FCඪ४ٕज़ͳͷͰɺಛఆͷπʔϧ ϥΠϒϥϦʹґଘ͠ͳ͍ w
ͦͷ··ϒϥβͰಈ࡞͢Δ
Browser Support
production-ready!
We don't need to use polyfill library!!!! (except for IE
and Edge)
Specifications • Custom Elements • Shadow DOM • HTML Template
• ES ModulesʢHTML Importsʣ HTML Modules
Custom Elements w ಠࣗͷػೳݟͨΛ࣋ͬͨ)5.-ཁૉΛ ఆٛͰ͖ΔΑ͏ʹ͢ΔͨΊͷ༷ w ఆٛͨ͠)5.-ཁૉͷλάΛ)5.-தʹ هड़ͯ͠༻͢Δ w ͜ΕҎ߱ʮಠࣗͷػೳݟͨΛ࣋ͬͨ)5.-
ཁૉʯͷ͜ͱΛʮΧελϜཁૉʯͱݺͿ
None
None
Shadow DOM w %0.ͷΧϓηϧԽΛ࣮ݱ͢ΔͨΊͷ༷ w 4IBEPX3PPUԼʹ4IBEPX5SFFͱ ݺΕΔ/PEF5SFF͕ੜ͞ΕΔ w άϩʔόϧͷ$44+BWB4DSJQU 4IBEPX%0.෦ʹӨڹ͠ͳ͍
None
None
HTML Template w <templates>ཁૉΛ༻͠)5.-υΩϡϝϯτ Ͱ)5.-ͷܗΛѻ͏ͨΊͷ༷ w ͜Ε8)"58(%0.4UBOEBSEͷҰ෦ʹ औΓࠐ·Ε͍ͯΔ w +BWB4DSJQU͔Βѻ͍͘͢͢ΔͨΊͷػೳ
֦ு͕ٞਐΜͰ͍Δ
None
ES Modules w &4Ͱಋೖ͞Εͨ&4.PEVMFTͷػೳΛ ར༻ͯ͠ɺ֎෦Ͱఆٛ͞ΕͨΧελϜཁૉΛ ಡΈࠐΉ w ͦͷલʹ)5.-*NQPSUTͱ͍͏༷͕ ଘࡏ͍͕ͯͨ͠ɺഇࢭ͞Εͨ w
HTML Modulesͱ͍͏༷͕ٞ͞Ε͍ͯΔ
HTML Imports w )5.-Λ)5.-ͰಡΈࠐΉͨΊͷ༷ w ࣅͨػೳΛ࣋ͭ&4.PEVMFTͷ༷͕҆ఆ͠ ϒϥβ࣮͕ग़ଗͬͨ͜ͱͰɺ ඇਪʹͳͬͨ w ݱࡏ།Ұ࣮͞Ε͍ͯΔ(PPHMF$ISPNF
͔Βय़ʹআ͞ΕΔ༧ఆ
HTML Modules w )5.-Λ+BWB4DSJQUͷதʹ*NQPSUՄೳ ʹ͢Δ༷ w 8FCQBDLͷIUNMMPBEFSʹࣅͨػೳΛ ϒϥβͰαϙʔτ͠Α͏ͱ͍͏ͷ w ·ͩ(JU)VCͷ*TTVFͰٞ͞Ε͍ͯΔஈ֊
ʢ$44.PEVMFTಉ࣌ʹٞ͞Ε͍ͯΔʣ
How to use Web Components with Vue.js?
None
None
How to build Web Components with Vue.js?
Vue CLI 3 Build Targets w 7VF$-*ͰCVJME͢Δͱ͖ɺ--target wcͱ ͍͏ΦϓγϣϯΛ͚ͭΔͱɺ7VFKTͷ ίϯϙʔωϯτΛ8FC$PNQPOFOUTʹ
มͯ͠CVJME͢Δ͜ͱ͕Ͱ͖Δ w ͜ΕͰੜ͞ΕͨϑΝΠϧɺ୯ମͰ 8FC$PNQPOFOUTͱͯ͠ಈ࡞͢Δ
None
None
@vue/web-component-wrapper w 7VFίϯϙʔωϯτΛϥοϓͯ͠ ΧελϜཁૉͱͯ͠ొ͢Δ w #VJME5BSHFUTͰ͜ΕΛ༻͍ͯ͠Δ w 7VFKTΛϥοϓ͍ͯ͠ΔͷͰɺ ௨ৗͷ8FC$PNQPOFOUTͱൺͯ ϑΝΠϧαΠζ͕େ͖͍
None
͜ͷػೳΛ͏͜ͱͰ Vue.jsͷίϯϙʔωϯτΛ Web Components εϜʔζʹҠߦͰ͖Δ
·ͨɺWeb Componentsͷ ෦తͳಋೖʹཱͭ
Why we use Web Components?
1. We can use the same component with any JavaScript
Libraries
For example... w 6*ϑϨʔϜϫʔΫΛ౷Ұ͍ͨ͠ +BWB4DSJQUϑϨʔϜϫʔΫ͝ͱʹ6*ϑϨʔϜ ϫʔΫ͍͚Δͷɺޮѱ͍ w ϑϨʔϜϫʔΫΛมߋ͠ͳͯ͘ͳΒͳ͘ͳͬ ͨͱ͖ɺ6*෦Λ͍ճ͢͜ͱ͕Ͱ͖Δ w
֎෦ެ։͍͢͠
2. Fully Scoped
For example... w େ͖͍ϓϩδΣΫτͰ$44ͷґଘ͕ؔ Α͘Θ͔Βͳ͍ͷͰɺHMPCBMͳ$44ʹӨڹ ͞Εͳ͍࣮͕͍ͨ͠ w ֎෦ެ։͍ͨ͠
Demerit w ଐੑʹ4USJOHܕ͔ͤ͠ͳ͍ w ֎෦͔Β͞ΕΔΠϕϯτͷϋϯυϦϯά͕ ͍͠ w %0.ཁૉͷऔΓճ͕͠໘ w $44ͷઃܭΛେ෯ʹݟ͢ඞཁ͕͋Δ
ਖ਼ɺ7VFKTͷػೳΛͬͯίϯϙʔωϯτ ࡞ͬͨ΄͏͕ॊೈͰػೳతͰ؆ܿ
3. Micro Frontends
Micro Frontends? • Be Technology Agnostic • Isolate Team Code
• Establish Team Prefixes • Favor Native Browser Features over Custom APIs • Build a Resilient Site
Think about a web app as a composition of features
Functions Normal Frontend
Function1 Micro Frontend Function2 Function4 Function3
Build a Resilient Site
w CSSͷมߋ w ༻͢ΔϥΠϒϥϦͷมߋ w JavaScriptͷมߋ w DOMߏͷมߋ • etc...
Web ComponentsͳΒ ScopedͳͷͰ มߋ͕༰қ
The biggest change that can be assumed = Framework migration
When Vue.js die, we should think about this
Why didn't we use Web Components earlier...?
ʁ A B A? B?
None
Replacing UI implementation with Web Components, we can respond flexibly
to changing frameworks
ͦΕ͕Webඪ४ͷڧΈ
What will become of us?
Vue.js is replaced by Web Components?
/P
Vue.js (and other frameworks) will be coexistent with Web Components
Web Components Vue.js (and other frameworks) Web Components Web Components
Web Components is "to encapsulate HTML elements"
Vue.js is "To make Web Applications"
5IFZEPOUEJSFDUMZ SFQMBDFCFDBVTF XIBUUIFZXBOUUPSFBMJ[F JTEJ⒎FSFOU
Summary
Summary w 8FC$PNQPOFOUTQSPEVDUJPOSFBEZ ͚ͩͲɺ՝ଟ͍ w 7VFKTͱ8FC$PNQPOFOUTڞଘͰ͖Δ w 6*Λ8FC$PNQPOFOUTʹ·͔ͤΔ͜ͱͰɺ ෛ࠴ΛݮΒ͢͜ͱ͕Ͱ͖Δ
Let's use Web Components!
THANK YOU! (font: Futura, ৽ΰ1SP)