VueJs Flashcards
SFC in VueJs
Single-File Component (SFC).
An SFC is a reusable self-contained block of code that encapsulates HTML, CSS and JavaScript that belong together, written inside a .vue file.
declarative rendering in VueJs
<template>...</template>
using a template syntax that extends HTML, we can describe how the HTML should look like based on JavaScript state. When the state changes, the HTML updates automatically.
reactive() vs ref() in vuejs
reactive(): Creates a reactive object for complex data structures like objects and arrays.
ref(): Creates a reactive reference for simple data types like numbers and strings.
wha’ts v-model in vuejs
doing both v-bind , v-on
v-model automatically syncs the <input></input>’s value with the bound state, so we no longer need to use an event handler for that.
what’s computed() in VueJs
We can create a computed ref that computes its .value based on other reactive data sources:
const filteredTodos = computed(() => {
what’s watcher in VueJs
like one of the features of useEffect
watch() can directly watch a ref, and the callback gets fired whenever count’s value changes.
watch(count,callback)
https://vuejs.org/tutorial/#step-10
how define props in vuejs
- composition:
defineProps({ msg: String })
```
<ChildComp :msg=’var’ />
<ChildComp></ChildComp>
```
https://vuejs.org/tutorial/#step-12
What’s emit in vuejs
a child component can also emit events to the parent:
const emit = defineEmits([‘response’])
`
<ChildComp @response=”(msg)=> childMsg=msg”/>
`
https://vuejs.org/tutorial/#step-13
what’s the Slots in VueJs
Slots in Vue.js are placeholders in a component’s template that allow the parent component to inject content into the child component.
https://vuejs.org/tutorial/#step-14