Skip to content

Vue

https://vuejs.org/

Vue.js, commonly referred to as Vue, is a progressive JavaScript framework used for building user interfaces. It is designed to be incrementally adoptable, meaning that developers can integrate Vue into existing projects or use it to build entire applications. Vue focuses on simplicity and ease of integration, providing reactive data binding and a component-based architecture.

Key features and aspects of Vue.js include:

  1. Reactive Data Binding: Vue provides a reactive data binding system, allowing developers to create dynamic and responsive user interfaces. Changes to the data are automatically reflected in the view, and vice versa.

    html
    <template>
      <div>{{ message }}</div>
    </template>
    
    <script>
      export default {
        data() {
          return {
            message: 'Hello, Vue!',
          };
        },
      };
    </script>
  2. Component-Based Architecture: Vue encourages the use of components to structure and organize the UI. Components are reusable, self-contained units that encapsulate their functionality and styling.

    html
    <!-- ParentComponent.vue -->
    <template>
      <div>
        <ChildComponent />
      </div>
    </template>
    
    <script>
      import ChildComponent from './ChildComponent.vue';
    
      export default {
        components: {
          ChildComponent,
        },
      };
    </script>
  3. Directives: Vue provides directives that can be used to perform tasks or apply behavior to the DOM. Common directives include v-if, v-for, and v-on.

    html
    <template>
      <div>
        <p v-if="isVisible">This is visible.</p>
        <ul>
          <li v-for="item in items">{{ item }}</li>
        </ul>
        <button v-on:click="handleClick">Click me</button>
      </div>
    </template>
    
    <script>
      export default {
        data() {
          return {
            isVisible: true,
            items: ['Item 1', 'Item 2', 'Item 3'],
          };
        },
        methods: {
          handleClick() {
            alert('Button clicked!');
          },
        },
      };
    </script>
  4. Vue Router: Vue Router is the official router for Vue.js applications. It allows developers to create single-page applications with client-side navigation.

    javascript
    import { createRouter, createWebHistory } from 'vue-router';
    import Home from './views/Home.vue';
    
    const routes = [
      { path: '/', component: Home },
      // other routes
    ];
    
    const router = createRouter({
      history: createWebHistory(),
      routes,
    });
    
    export default router;
  5. Vuex: Vuex is the state management library for Vue.js. It helps manage the state of the application in a centralized store, making it easier to handle state changes and interactions between components.

    javascript
    import { createStore } from 'vuex';
    
    export default createStore({
      state() {
        return {
          count: 0,
        };
      },
      mutations: {
        increment(state) {
          state.count++;
        },
      },
      actions: {
        incrementAsync({ commit }) {
          setTimeout(() => {
            commit('increment');
          }, 1000);
        },
      },
    });
  6. Vue CLI: Vue CLI is the official command-line interface for Vue.js. It provides a set of tools for scaffolding, building, testing, and deploying Vue.js applications.

    bash
    # Create a new Vue project
    vue create my-project
    
    # Navigate to the project folder
    cd my-project
    
    # Run the development server
    npm run serve
  7. Vue Devtools: Vue Devtools is a browser extension that enhances the Vue.js development experience. It allows developers to inspect and debug Vue applications in the browser.

Vue.js is known for its simplicity, flexibility, and gradual learning curve, making it a popular choice for both beginners and experienced developers in the web development community. Keep in mind that the examples and features mentioned here are based on the state of Vue.js, and there may have been new releases or changes since then.

Vue.js certification
Quick start

Articles

Composition api setup

Examples

Vue 3 real world app
Vue 3 real example app

Released under the MIT License.