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
WebComponent
Search
milkmidi
August 12, 2023
Programming
1
3.1k
WebComponent
2023 Webconf - WebComponent
milkmidi
August 12, 2023
Tweet
Share
More Decks by milkmidi
See All by milkmidi
202403-WebComponent
milkmidi
0
160
前端好朋友-tailwindcss
milkmidi
0
8k
202110-federation
milkmidi
0
140
Vue3一次就上手
milkmidi
0
6.3k
202007-React對戰雷台
milkmidi
0
170
Other Decks in Programming
See All in Programming
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
740
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
42 best practices for Symfony, a decade later
tucksaun
1
180
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
Beyond ORM
77web
5
560
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
210
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
CSC305 Lecture 26
javiergs
PRO
0
140
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
useSyncExternalStoreを使いまくる
ssssota
6
1k
return文におけるstd::moveについて
onihusube
1
1.1k
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Code Reviewing Like a Champion
maltzj
520
39k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Rails Girls Zürich Keynote
gr2m
94
13k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Practical Orchestrator
shlominoach
186
10k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Statistics for Hackers
jakevdp
796
220k
Transcript
如何⽤ React 發⼤財 WebComponent 202308 - milkmidi
milkmidi (奶綠茶) PositiveGrid Staff Frontend Engineer
[email protected]
https: / / www.facebook.com/milkmidifans
Ten years ago!
jQuery Flash Action Script Silverlight RWD 是三⼩! bootstrap
10 年前奶綠出過兩本書 已絕版 每年都要拿 Flash 出來鞭⼀下
Web Development Trends in 2023 React / Vue / Angular
Flash Action graphQL TailwindCSS webassembly Webpack / Vite No jQuery Test
我也想靠 Flash 吃⼀輩⼦呀 結果 Jobs ⼀句話我就失業了
Why WebComponent?
PM 要請你修改 sign-in 功能,這時你會 ?
jQuery 再戰⼗年
None
None
None
WebComponent 是你的救贖
None
None
1 好找,好改 2 限縮 JS scope 3 準時下班
PM說: 現在要修改登出鈕按的⾏為。 不急,⼗分鐘後再給我就好
這時你要回答?
None
要使⽤前有個 But ⼈⽣就是這個 But
None
How to use?
None
None
connectedCallback() Invoked when the custom element is first connected to
the document's DOM. disconnectedCallback() Invoked when the custom element is disconnected from the document's DOM. attributeChangedCallback() Invoked when one of the custom element's attributes is added, removed, or changed. Life cycle callbacks
attributeChangedCallback
Shadow DOM 與世隔絕的安全⼩屋 這我家的貓,很可愛吧
None
外層和 Shadow DOM 的 style 不會互相影響 但,也是缺點 透過 attachShadow( {
mode } ); 可以讓外層的 JS 是否可以呼叫 shadowDOM 裡的元素 mode: open:element.shadowRoot // ShadowRoot obj mode: closed: element.shadowRoot // null
Shadow DOM + slot 這我家的貓,很可愛吧
None
下段語法寫錯,正確為 document.createElement(‘my-component’)
Web Component 就是這麼簡單
加薪技能樹
WebComponent + petite-vue
None
都是尤⼤⼤開發的 Only ~ 6kb DOM-based, mutates in place(not virtual DOM)
petite-vue
None
None
https://www.positivegrid.com/products/spark 實際應⽤
None
WebComponent 限縮 scope petite-vue 處理阿雜的 DOM 事件 本來專案就走 SSR 的情況下,很適合導入
工具沒有好或壞 用的好帶你上天堂 還是我家的貓,還是很可愛
學習不需要為公司、長官或同事, 不需要為別人,只為你自己。 五倍紅寶石-高見龍
⼯商服務 Positivegrid 徵 Senior Android Engineer Senior Backend Engineer Machine
Learning Engineer C++ Developer
QA
https://www.facebook.com/cmoneyengineer/photos https://www.facebook.com/groups/2616981278627207 圖片出處