VUE
Vue is a progressive framework for building user interfaces. It is designed to be approachable and flexible, and can be used to create everything from simple websites to complex web applications.
Getting Started
To get started with Vue, you can follow these steps:
- Install Vue using a package manager like npm or yarn.
- Create a new Vue project using the vue create command.
- Write your Vue components using HTML, CSS, and JavaScript.
- Build your Vue project using the npm run build command.
- Deploy your Vue project to a web server or hosting provider.
Documentation
The Vue documentation is available online at vuejs.org. This documentation includes guides, tutorials, and reference material for learning Vue and using it effectively.
- Vue 3 Reference Component
- Ref vs. Reactive - Pick One, Kill the Other
- Which One to Choose (Options or Composition)
- Clean Layout Architecture for Vue Applications
- Refactor Your Vue Application By Using Setup Scripts
- What is Single File Component (SFC)
- Vue3 Getting Start
- 20++ Essential Articles for Vue.js (Vue 3) Beginner
- Some Vue 3 Tricks to Know
- Composition Pattern, Composition API, and Composables
- Vue Render Optimization with v-once and v-memo
- Working with a Constants Folder
- Handling Environment Variables in Vue
- Database Connection (PHP File)
- Top 10 Vue.js UI Libraries in 2024
- Top 6 Vue.js UI Libraries in 2024
- VueJS Unit Testing: What It Is and How to Write It
- How to Use Bootstrap5 with Vue3
- Bootstrap Table
- An extended table to the integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)
- Bootstrap Table
- How to Use Vuetify, Axios and Material Design Icons with Vue3
Useful Links
- What’s New in Vue 3
- Chatbot Being Trained Using Vue.js Docs
- The Power of Vue.js
- Interesting Cheatsheet for Anatomy of Vue Component
- Vue.js State Management
- Cheatsheet for Vue.js State Management
- Learn Vue 3: Step by Step
- Vue3 Full Course - 10 Apps in 10 Hours
- Türkçe Source for VueJs
- Türkçe Source for Design Patterns (Java & C# Examples)
- Pinia Cheatsheet
- VueUse
- Collection of essential vue composition utilities
Vue CLI
Vue comes with a command-line interface (CLI) tool that can help you scaffold new projects, add plugins, and perform other common tasks. You can install the Vue CLI using the npm install -g @vue/cli command.
Composition Api
Vue 3 Composition API is a new way of writing Vue components that was introduced in Vue 3. It provides a set of functions and APIs that allow you to organize your component code in a more flexible and reusable way.
In the Composition API, you write your component logic as a series of functions that can be reused across multiple components. These functions can be composed together to create more complex behavior, and they can be easily tested in isolation.
Overall, the Composition API provides a more flexible and powerful way of writing Vue components that can make your code easier to maintain and reuse.
- 10 Mistakes to Avoid When Starting with Vue 3
- Vue3 Script Setup Cheat Sheet
- General Notes for Vue3
- Ref vs Reactive
- Mutation in Vuejs Composition API
- Vue3 Reactivity Hacks: The Key-Changing Technique
- Force Vue to Rerender a Component
- Web Socket and Redis Usage with Vue3
Composition Examples
Below are the templates and examples from Vue3 Composition Api (script setup).
NOTE: If you cannot start some of the project be sure that node_modules
is properly installed. To install node_modules properly, run the following command in the project’s folder.
npm install
- Vue3 Template with TypeScript
- Confetti.js with Vue3
-
Vue 3 Tutorials
- Vue3 (Composition Api) Template
- Hello World!
- Declarative Rendering
- Attribute Bindings
- Event Listeners
- Form Bindings
- Conditional Rendering
- List Rendering
- Computed Property
- Lifecycle and Template Refs
- Watchers
- Components
- Components (Child Component)
- Props
- Props (Child Component)
- Emits
- Emits (Child Component)
- Slots
- Slots (Child Component)
- You Did It!!!
Options Api
The Options API is a way of defining Vue.js components using a simple JavaScript object that specifies various options such as data, computed properties, methods, and lifecycle hooks. This is the traditional and simpler way of defining Vue components, and it is still supported in the latest version of Vue.
Overall, the Options API is still a useful and valid approach for building Vue 3 components, but the Composition API provides more advanced features and flexibility.
Options Examples
- Vue2 (Options Api) Template
- Hello World!
- Declarative Rendering
- Attribute Bindings
- Event Listeners
- Form Bindings
- Conditional Rendering
- List Rendering
- Computed Property
- Lifecycle and Template Refs
- Watchers
- Components
- Components (Child Component)
- Props
- Props (Child Component)
- Emits
- Emits (Child Component)
- Slots
- Slots (Child Component)
- You Did It!!!
- Text Area and Button Example
- For & Foreach & Derivatives Example
Vue Router
Vue Router is a powerful routing library for Vue that allows you to create complex, multi-page applications. It provides features like nested routes, route guards, and dynamic route matching. You can learn more about Vue Router in the official documentation.
Pinia
Pinia is a state management library for Vue. It is inspired by Redux, but it provides more features and flexibility. Pinia works for both Vue 2 and Vue 3 and doesn’t require you to use the composition API. The API is the same for both except for installation and SSR. You can learn more about Pinia in the official documentation.
Vuelidate
Vuelidate is a validation library for Vue. It provides built-in validation rules and reactive validation.
Vuelidate is considered model-based because the validation rules are defined next to your data, and the validation tree structure matches the data model structure. You can learn more about Vuelidate in the official documentation.
- Installation
npm install @vuelidate/core @vuelidate/validators
- Example Usage
<script setup lang="ts">
import { reactive } from 'vue' // "from '@vue/composition-api'" if you are using Vue <2.7
import { useVuelidate } from '@vuelidate/core'
import { required, email } from '@vuelidate/validators'
const state = reactive({
firstName: '',
lastName: '',
contact: {
email: ''
}
})
const rules = {
firstName: { required }, // Matches state.firstName
lastName: { required }, // Matches state.lastName
contact: {
email: { required, email } // Matches state.contact.email
}
}
const v$ = useVuelidate(rules, state)
</script>
<template>
<div :class="{ error: v$.firstName.$errors.length }">
<input v-model="state.firstName" />
<div class="input-errors" v-for="error of v$.firstName.$errors" :key="error.$uid">
<div class="error-msg"></div>
</div>
</div>
</template>
- This approach will dynamically cover any number of validators that were applied to our input.