Vue.js is a progressive Javascript framework used to create user interfaces (UI) and single page applications (SPA). With a basic knowledge of HTML, CSS and Javascript we can start creating web applications in Vue.js. Vue.js was created by combining the best features of existing corner and reaction frames. Developers love programming and feel free and comfortable creating applications in Vue.js.

This component based approach was mainly inspired and adopted by ReactJS. We write the code as components, so that we can import that component and reuse it where we need it. Vue.js offers a single-file component, making the code freely linkable and reusable.

Vue.js offers the best component approach like any other development approach; it can be found in a single .view file. Developers feel as comfortable and relaxed as they don’t have to worry about the extra structure of the component.

In this article we’ll focus on a single file component with the .view extension. So let’s take a look at a very simple example of the View component and see how it works.

 

World

 

p {
Font size: 1em;
Text alignment : Centre;
}

This is a very simple and straightforward example of the View component. Where you can see that the code is divided into three layers. This three-layer syntax is the best part of Vue.js. This complies with the separation of problems, but is at the same time contained in a single .view file. We have our template (HTML), the logic in Javascript and the style in the component.

Model

We write our HTML code in this template tag. In this case, we can also bind variables using the binding syntax of Vue.js, and we can also add other functions using the syntax provided by Vue.js for the corresponding functionality.

Scenario

In this section we can write component logic in Javascript using the Vue.js syntax. All functions and the logic of the component go here. For example, for example..,

  • Import of other components and packaging required.
  • Variable reporting
  • Methods/Functions
  • Life cycle hook
  • Calculation properties and observers
  • And so on and so on…

Style

Here we write the style of the component in CSS, or we can use any preprocessor we want.

This is just a blinking item in Vue.js. Let’s look at the use, organization and flow of data between the components.

Importation and use of components

To use a part, you must import it first. How else would Vue.js know? We can easily import a component by adding the import operator at the beginning of a script tag and declare this component in the component object using the following syntax

 

After successfully importing a component, we can use it in the model as follows

 

This way we can easily import the part and use it in any other part.

Organizational components

Just like any other application, the component organization works like a nested tree. For example, a simple website that contains the header, sidebar and some other elements in the container. The organization of the division would look like this.

Photo of Vue.js Official documents

Data flow between components

There may be two types of data streams between the components: From the parental component to the child component

We may use an accessory to send data from a parent component to a child component: Child component – older component

We can send data by triggering an event from the child component and listening to the other side (parent component).

Packaging

In this article we have gone as far as understanding the main component of Vue.js to the use, hierarchy, organization and implementation of the input, use and interaction know-how between the components. In this article many elements are discussed, but there is also a lot of in-depth knowledge about the components. For more information, please contact Vue.js Official Docs.

best vue extensions for vs code,vue.js visual studio 2019,run vue app locally,vue scaffold visual studio code,vetur autocomplete not working,vscode vue syntax highlighting not working

You May Also Like

ASUS ZenBook 14 UM425 with Ryzen 7 4700U beats Intel’s pricing with enhanced features

If there’s one thing everyone’s talking about now, except the iPhone 12,…

Minisforum EliteMini H31G Windows 10 and Linux PC impressions

For some reason, I like miniature desktops. From the Apple Mac mini…

Can’t type in Windows 10 Search Bar fix

Windows 10 is available with many features to improve productivity and usability.…

How to extrude in AutoCAD

The many commands AutoCAD provides also include an Extrude command. Used to…