VueJS Practice – #1 Project Structure

VueJS Practice – #1 Project Structure

In VueJS 2 Practice we will explore a possible solution to a simple Problem: How to structure your Project, Folders, Assets and Single File Components?

Task

Create a VueJS Project/Folder Structure, that will contain Components for Detail views of products, users and payment steps. It’ll also contain a file with vuex state definitions. The project will also include API fetching methods, that should be accessible from every Single File Component.

Hints

  • Take a look at the official recommendation for VueJS Project Structure.
  • The API fetching methods need to be centrally available. What else is centrally available in your App?
  • Read the detailed VueJS Style-Guide

Solution

Your Project Structure would look like the one presented in the screenshot.

You have two VueJS Components „*Detail.vue“ and „*List.vue“ for each products, assets and users.

Your vuex state definitions are obviously in the „vuex-“ store.js file.

The hardest one was probably the placement of the API fetching methods. There is no right answer, but there is my answer that worked for me many times. Since your methods need to be available centrally, the vuex Store-Object in store.js is the perfect place for it. You combine the actions method in store.js Store-Object with your API fetching methods.

  actions: {
    getUsers(context) {
      const users = axios.get('https://myresturl.com/users/all')
      context.commit('increment', users)
    }
  }

Then you can call from every part of your Application the following line and execute your method. The best part of this structure is that you can directly insert your freshly fetched data into the Vuex Store.

this.$store.dispatch('getUsers')

And that is how you solve this VueJS 2 Practice . If you love VueJS like we do, please consider enrolling in our VueJS Certificate Course. It’s on-demand with lifetime access!

Top 3 UI Frameworks for VueJS

Top 3 UI Frameworks for VueJS

Among all JavaScript frameworks, one has been particularly gaining popularity in recent years: Vuejs. A Soft learning curve, Virtual DOM and many other features make Vuejs unique and useful. Vuejs is a JavaScript framework for building user interfaces but it doesn’t provide actual UI elements or components we can use. Frameworks help designers and developers to focus on the features which they want to add for their projects rather than focusing on reinventing the coding. That’s why many UI frameworks have been built to provide users with reusable and styled-components. Here, we will discuss the top three UI frameworks that can be used with Vuejs.

Vuetify

Vuetify is a material design component framework that lets you create clean and reusable UI components. It works with Vue’s Server Side Rendering and has premium themes. Vuetify has great support and continuous updates which helps users to remain up to date. Steps to install Vuetify are given below:-

  • First, you need to upgrade to Vue CLI 3 or above using the following command:
Vue CLI 3 Command
  • Then create a new Vue.js project using Vue CLI 3:
Code For VueJS 1

Make sure that you select all the things you need for the project by manually selecting the features. The above picture shows a sample of what you can start with and the name of the app.

  • After you have instantiated the project, add the Vuetify package.
Code For VueJS 2

                Choose the default preset and you are good to go.

Quasar

Quasar is an MIT-licensed and simple to use UI framework that can be used to build front-end apps. It provides a color palette with a variety of colors in it and other form features like slider, checkbox, etc which makes it very useful. Below are the installation steps for Quasar:-

  • First, check the version of npm and node (node>=8 and npm>=5) by using below commands:
Code For VueJS Quasar 1
  • Then we will install the Quasar CLI:
Code For VueJS Quasar 2
  • Now we can create a project folder with Quasar CLI.
Code For VueJS Quasar 3

And start working on a project.

Element

Element is a UI component library that has versions for React, Angular, and Vuejs. The Popularity of element speaks for itself with more than 40k stars on Github. The wide variety of components which Element provide, makes it one of the top three UI framework or library used for Vuejs. Steps to install Element is very simple, just run the following command:-

Code For VueJS Element 1

Now you can import and use it as follows:-

Code For VueJS Element 2

There are many other UI frameworks and libraries that can be used with Vuejs like Fish-UI, Buefy, Vux, AT-UI, etc. but these three provide many components as compared to others and their popularity will increase in the near future.

GITA Coach Andrey Bulezyuk

GITA Coach Andrey Bulezyuk

Andrey Bulezyuk is the founder of German IT Academy and a course creator. He mainly covers topics from Web Development (NodeJS, VueJS, Django etc.) to Data Science (Pandas, Numpy) and Machine Learning (Tensorflow, Keras, etc.).

What is VueJS?

He published a German book „Algorithmic Trading„, giving his readers the opportunity to learn how to code automatic trading systems for the stock market or the Forex. 

He has experience as a Backend and Frontend Developer. In his early years he worked on Web Projects as a Freelancer. Switched later to Financial Market System Developing. Currently employed as Machine Learning Engineer. 

He takes part in different projects and acts as a Co-Founder in different small start-ups. Andrey Bulezyuk was an employed Full-Stack Developer in Munich. Currently his duties do cover areas of Machine Learning and ETL.

Andrey Bulezyuk
Material Design with VueJS

Material Design with VueJS

Do you have a VueJS App or do you want to build a Vue App and you want to have a nice Material Design? 

WHAT IS MATERIAL DESIGN?

Material design is a guideline with predefined rules. Both describe how your application should look like in order to make your application look consistent and usable across all parts and devices.

HOW TO USE MATERIAL WITH VUEJS?

In order to implement Material Design in your VueJS Application you could create your own Components and style them according to the Material Principles.

We are going to explore the usage of third party tools inside our Vue App.

The quick and lightweight approach is to use some CSS Library like Material Boostrap (https://fezvrasta.github.io/bootstrap-material-design/). We will use the Vue Native approach and use the Vuetify Framework.

VUETIFY FOR MATERIAL VUEJS

Installation

In vue-cli3 User Interface find install Vuetify.

If your project cannot be used with vue-cli3, then go with „$ npm install vuetify

HOW TO BECOME A VUE.JS DEVELOPER?

We’ve got something for you. Check out the VueJS Junior Course. In this online course you will dive deep into how Components work and how you can quickly create a Vue.js Website.

ACTIVATION IN VUE SOURCE CODE

You have first import Vuetify in main.js. Then you tell your Vue App to use the freshly imported Vuetify.

USAGE OF VUETIFY COMPONENTS

Now that you have Vuetify in your Application, you can go ahead and start using all the Components that this big framework offers you. Where to begin? Start with the official library of all available Components (https://vuetifyjs.com/en/components/api-explorer).

Let’s use a simple Component called „Carousel“: <v-carousel>.

When you save this Component and open it in the browser, you should see something like this:

What is Vue.js?

What is Vue.js?

Vue.js is one of those new software technologies that are been used in web development companies for building users interface. Vue.js is primarily and uniquely designed from the ground up to be incrementally adoptable. It offers data reactive components with a simple and adaptable API.

Application programming advancement is one of the most prominent organizations been practiced at both individual as well as big business levels. A great deal of programming advancement is the usage of lots of software technologies by programmers to make the applications faster, user-friendly and more attractive. Vue.js is been referred to as the JavaScript system with different discretionary instruments for structuring user interfaces and single-page applications.

What famous companies uses vue.js.

Ex-google staff Evan You developed vue.js also known as vue in 2014. Vue.js popularity is continuously growing and there are no signs of slowing down. In the last few years, vue.js has experienced a substantial shift in popularity in which a sudden change in the number of stars of vue on GitHub take place in the mid-2016 and has enabled vue to be the most popular framework, leaving it in a very strong position against the competition. Buzzfeed, Codeship, Grammerly, Trustpilot, Netflix, Adobe, Alibaba, Facebook, Laravel Spark are some of the big companies that efficiently uses vue.js.

One of the reasons for vue.js popularity is the variety use of its components, which make development much easier to understand.

For a deep understanding of VueJS Components get our VueJS Certificate Junior.

Why developers love it

A large number of developers love vue.js because it is quite easy to learn. Since it is a JavaScript framework, your development team can adequately understand the system without any issues, challenges or unnecessary stress. Another major determinant of it usage by developers is the fact that applications developed with vue.js are highly effective.