- Vue is a JS framework for building web frontends (browser web applications)
- JS is the programming language that is supported by all frameworks
- Framework is a third party library that has a set of rules and functionalities. (Framework vs libraries, is that frameworks has rules for build)
- The cycle
- User makes a request to a server
- An HTML page is sent back to the user with updated data
- DOM is the HTML structure
- Why is JS used?
- Rather than having to send user info to the server, and then back, the Javascript can manipulate the HTML structure, so we don’t need to make a request to a server and wait for a response
- Vue can be used
- to control certain parts of pages (widgets) (multi pages)
- entire pages (single pages)
- Interpolation can be done using double curly braces. It binds data from the Vue Instance to the HTML. The data is then rendered in the DOM
When creating a Vue App
- you use a JS file that refers to html elements
- The Vue app generally has
- data that is interpolated in the html code
- methods that are functions that manipulate the data
- the methods can refer to the data objects by using the
this
keyword (used for data binding to outsource logic)
- computed properties are used with data binding, used when data is based on other data
Vue Directives
- v-on: attaches an event listener to the element
- v-once: renders only once
- v-for: a for loop
Watchers