Skip to main content

Posts

Showing posts from April, 2023

Vue Js (Basics 2)

Vue Data Data Now that our Vue app is hooked up to our HTML, we are ready to generate and display dynamic data. As discussed in Introduction to Vue, displaying and updating dynamic data for users is essential functionality for most front-ends. Most values on the web can change at any moment, such as the number of likes on a post or the current set of posts to display. We call constantly-changing data values like this dynamic data . We need a place to store dynamic data values so that we can still use them in our HTML even when we don’t know what their values will be at any given moment. There are many different ways to do this in Vue. The simplest way is the data property on the options object. The value of data is an object. Each key-value pair in this object corresponds to a piece of data to be displayed in the template. The key is the name of the data to use in the template and the value is the value to display when the template is rendered. We then use mustache sy

Vue JS (basics 1)

  INTRODUCTION TO VUE Creating Vue Apps Our project now has access to the Vue library. This gives us access to all of the code that will allow us to make Vue apps, web front-ends built using Vue, but doesn’t actually create one for us. We now need to write the code to actually make a Vue app. Vue makes it easy to make a new app by exporting a class called  Vue . Much like any other JavaScript class, we create instances of this class using the  new  keyword. Each of these  Vue  instances is a fully-functioning Vue app. Let’s look at an example: // app.js const app =  new Vue ({}); By invoking the  Vue  class constructor with the  new  keyword, we create a new instance of the  Vue  class which we name  app . The  Vue  constructor can set many properties on our Vue app when it is called. However, unlike many constructors, the  Vue  class does not take each of these properties as separate arguments. Rather, it only takes one argument. Vue apps require a lot of information — information t