Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
vue [2020/09/24 03:32] paul created |
vue [2020/11/14 19:34] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
I'm learning Vue while also learning javascript. | I'm learning Vue while also learning javascript. | ||
+ | |||
+ | The following tutorial has a really nice complete vue with rest api and vue | ||
+ | router example. | ||
+ | |||
+ | [[https:// | ||
===== Directives ===== | ===== Directives ===== | ||
[[https:// | [[https:// | ||
+ | |||
+ | ==== v-bind ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ===== Vue Object ===== | ||
+ | |||
+ | In the new Vue object, there seems to be a list of parameters you can pass in. | ||
+ | |||
+ | <code javascript> | ||
+ | new Vue({ | ||
+ | el: '# | ||
+ | data:{ | ||
+ | price: 100, | ||
+ | taxRate: 0.10, | ||
+ | }, | ||
+ | |||
+ | computed: { | ||
+ | tax: function() { | ||
+ | return this.price * this.taxRate; | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | ==== Computer Properties ==== | ||
+ | |||
+ | Computer properties are just like properties but they are computed based on a | ||
+ | function. You then can use them just like a property in the template section. | ||
+ | |||
+ | <code javascript> | ||
+ | computer: { | ||
+ | tax: function() { | ||
+ | return this.price * this.taxRate; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Methods ==== | ||
+ | |||
+ | Methods are your functions in Vue. They take in parameters and can return | ||
+ | anything. | ||
+ | |||
+ | ==== Slots ==== | ||
+ | |||
+ | Slots | ||
+ | |||
+ | Here's a [[https:// | ||
+ | ===== Components ===== | ||
+ | |||
+ | Components in Vue allow you to create html like elements that you custom make. | ||
+ | You need to pass in a template to build them. In the template you need to have | ||
+ | only one root element, so wrap everything in a '' | ||
+ | |||
+ | <code javascript> | ||
+ | Vue.component(' | ||
+ | props: [' | ||
+ | template: ` | ||
+ | <div> | ||
+ | <hr> | ||
+ | <p>{{ item.title }}</ | ||
+ | <button @click=" | ||
+ | <p v-if=" | ||
+ | <p v-if=" | ||
+ | </ | ||
+ | `, | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | Child components can communicate to parent components by using '' | ||
+ | |||
+ | Much easier to use Vuex which allows for a state store that you can access from | ||
+ | any component. | ||
+ | |||
+ | ===== Vue CLI ===== | ||
+ | |||
+ | Bunch of tooling for scaffolding a Vue project. Purty cool. | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ===== Firebase authentication ===== | ||
+ | |||
+ | You can set up authentication through firebase by installing firebase in your project, setting it up using a firebase.js file and then setting up the router to guard routes that need to be authorized. | ||
+ | |||
+ | ===== Vuetify ===== | ||
+ | |||
+ | I am trying out Vuetify for a frontend because it looks to have more support | ||
+ | than Bulma (Beufy based front end). | ||
+ | |||
+ | I added vue by doing '' | ||
+ | |||
+ | ''< | ||
+ | |||
+ | You can use props on tags to modify them. They can be just one word on the html | ||
+ | tag. | ||
+ | |||
+ | Here's a sampling of stuff you can do to tags: | ||
+ | |||
+ | <code html> | ||
+ | <p class=" | ||
+ | </ | ||
+ | |||
+ | ==== Extras ==== | ||
+ | |||
+ | You can use fontawesome and icon materials with vuetify. You can add them to the | ||
+ | vuetify.js file. | ||
+ | |||
+ | <code js> | ||
+ | import ' | ||
+ | import ' | ||
+ | import Vue from ' | ||
+ | import Vuetify from ' | ||
+ | |||
+ | Vue.use(Vuetify, | ||
+ | | ||
+ | }) | ||
+ | </ | ||
+ | |||
+ | ==== Grid ==== | ||
+ | |||
+ | Learning how to use Vueitfy grid. | ||
+ | |||
+ | All grid elements go inside a '' | ||
+ | |||
+ | The tags that go in '' | ||
+ | '' | ||
+ | |||
+ | ==== Input validation ==== | ||
+ | |||
+ | You can run rules inside a debounce function very easily if you follow this | ||
+ | syntax: | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ==== Watch ==== | ||
+ | |||
+ | To run code whenever a variable changes use watch functions. To watch data that | ||
+ | is nested in other data you can follow this: | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ==== Data Tables ==== | ||
+ | |||
+ | https:// | ||