init static property
🚧 under construction ->
Last updated
Was this helpful?
🚧 under construction ->
Last updated
Was this helpful?
⟩ ⟩ ⟩ ⟩ ⟩ ⟩ init
static block:用於對 的初始化
web component:可用這裡的方法初始化 component 的靜態屬性
1
✅ 延遲初始化
額外的私有靜態屬性
2
不夠模組化
3
✅ 模組化
ES2022
4
✅ 模組化
MDN ⟩ ⟩ ⟩ ⟩
ChatGPT ⟩
方法三:使用 (ES2022)(方法二的現代版)
方法四:使用 賦值
codepen ⟩