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
Eleventy3.0 で始める爆速個人ブログ開発!
takanorip
0
96
Webフォント選定の極意!フォントの基本から最新トレンドまで徹底解説
takanorip
5
760
効果的な管理画面を デザインをするために 避けるべき5つの罠
takanorip
14
6.8k
社内管理画面のデザインもプロダクトデザイン
takanorip
4
1.7k
早わかり W3C Community Group
takanorip
0
450
Ubieとアクセシビリティのこれからを考える
takanorip
0
420
2023年版 デザインシステム 技術選定の勘所 - フロントエンドカンファレンス沖縄
takanorip
2
3.8k
Astroで始める爆速個人サイト開発
takanorip
15
11k
後悔しないデザインシステムの始め方
takanorip
4
3.1k
Other Decks in Programming
See All in Programming
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
240
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
11
1.8k
Linux && Docker 研修/Linux && Docker training
forrep
23
4.5k
JavaScriptツール群「UnJS」を5分で一気に駆け巡る!
k1tikurisu
10
1.8k
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
220
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
29
11k
SpringBoot3.4の構造化ログ #kanjava
irof
2
970
Honoをフロントエンドで使う 3つのやり方
yusukebe
4
2.1k
Kanzawa.rbのLT大会を支える技術の裏側を変更する Ruby on Rails + Litestream 編
muryoimpl
0
220
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
670
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.7k
[JAWS-UG横浜 #79] re:Invent 2024 の DB アップデートは Multi-Region!
maroon1st
1
140
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
29
2.2k
Gamification - CAS2011
davidbonilla
80
5.1k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Thoughts on Productivity
jonyablonski
69
4.5k
Become a Pro
speakerdeck
PRO
26
5.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Documentation Writing (for coders)
carmenintech
67
4.6k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
8
270
Typedesign – Prime Four
hannesfritz
40
2.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
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)