Vue basics Flashcards
A simple set of card to understand the fundamentals of the vue framework
What is reactivity?
- Reactivity is a programming paradigm that allows us to adjust to changes in a declarative manner.
What is a Proxy?
- Proxy is an object that encases another object or function and allows you to intercept it.
- The Proxy object enables you to create a proxy for another object, which can intercept and redefine fundamental operations for that object.
A Proxy is created with two parameters:
- target: the original object which you want to proxy
- handler: an object that defines which operations will be intercepted and how to redefine intercepted operations.
Why are proxy’s important to understand when using Vue?
- They are core funcationality of Java script that Vue uses to make it reacative
- Proxy is an object that encases another object or function and allows you to intercept it.
How many vue apps can you have per page
as many as you want. Imporant they will work independitly from each other They cannot share data
What are templates
They are used to insert template html in a vue app.
What is the purpose of $Ref in relation to Vue?
We use the $ref in our Vue.js code. to provide and object which provides a complete list of the references defined in the HTML code.
Example:
referencing the input “text”
ref=”input”>
- to log the out put in vue js*
console. log(this.$refs.input)
would log the value of “input”
what does $ represent.
A dollar sign $ will refer to Vue instance properties and methods.
- They are prefixed to differentiate the from user-defined properties
- Examples : this.$refs vm.$data vm.$props
reference
https://vuejs.org/v2/api/#Instance-Properties
Why would you use .value in javascript?
.values() is used to coovert on an object to return into an array containing the values as an an array.
const object1 = { a: 'somestring', b: 42, c: false };
**console.log(Object.values(object1));** // expected output: Array ["somestring", 42, false]
What is Virtual Dom?
The Virtual Dom:
The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library This process is called reconciliation.
It is used :
To tell what state you want the UI to be in, and it makes sure the DOM matches that state.
What is the Vue instance Lifecycle?
It describes the life cycle of an app
- what the step processes for mounting
- before mount \ mounted before
- update updated
- before unmount
- unmounted
what are Vue components?
- They are used when you want to reuse HTML blocks
- They are normally broken up into specific functionality specific to that block.
- splitting up a large app or min apps
what is the:key attribute why is it important?
- The key attribute is used on lists.
- It indicates the unique variable ( primary key ) that the list can iterate over
- *
How do you create a component?
app.component(‘name-something’);
- The name should always have a dash
- e.g foo-barr my-name
- This avoids clashing with bulit in elements
How do you use components?
You insert the same way as you would use a normal div
*
why build ann interface with components
- Components are building blocks that simplify the structure of apps.
- They proved a communication mechanism that allows components to speak across components, this does not happen with multiple apps.
// check this and come back when you’re sure.
: study components