VueJs Flashcards

1
Q

SFC in VueJs

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

declarative rendering in VueJs

A

<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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

reactive() vs ref() in vuejs

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

wha’ts v-model in vuejs

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what’s computed() in VueJs

A

We can create a computed ref that computes its .value based on other reactive data sources:

const filteredTodos = computed(() => {

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what’s watcher in VueJs

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how define props in vuejs

A
  • composition:
    defineProps({ msg: String })

```
<ChildComp :msg=’var’ />

<ChildComp></ChildComp>

```

https://vuejs.org/tutorial/#step-12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What’s emit in vuejs

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what’s the Slots in VueJs

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly