~/talk

20 Ways to Define Props in Vue from Mundane to Deranged

Talkat Connect.Tech 2024 · 2024-11-18..11-20· [vue, frontend-architecture]
slides:none on file

Lists twenty concrete ways to declare Vue props, from plain string arrays to TypeScript-driven compiler macros, and demonstrates what actually runs in the browser versus what requires a build step. Shows DefineProps macro with type generics and withDefaults, explains modelValue + update:modelValue pairing and the DefineModel convenience, covers JSX via defineComponent, validator/default/function semantics, and a CodePen proof-of-concept for a dangerous useMagicProps hack that dynamically injects props — it partially works in the demo but is explicitly discouraged.

AI-written summary · about

  1. 0:00Introduction to props
  2. 1:11Basic prop definitions
  3. 3:39Adding type safety
  4. 5:05Required props and defaults
  5. 8:20Prop validators
  6. 10:27Runtime vs build time
  7. 13:46Script setup magic
  8. 19:26TypeScript with props
  9. 24:25Default values in TypeScript
  10. 26:14Extending base props
  11. 29:02Model value simplification
  12. 32:17JSX components in Vue
  13. 35:03Unhinged prop hacks
  14. 41:49Magic props demonstration
  15. 42:54Q&A and closing remarks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.