Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 25, 2023 06:34 pm

Vue.js Tutorial: Beginner to Front-End Developer


This course will teach you the fundamental concepts you need to start building applications with Vue.js.






Who Is This FREE Course For?



  • complete beginners who want to be web developers

  • experienced developers who want to explore advanced topics

  • any coder who enjoys learning something exciting


How Long Is the Course?


This course is 4 hours 22 minutes long, and it’s split into 35 lessons in total. You’ll find it’s a great resource that you will come back to often.



In this course, you'll learn why Vue.js is a great choice for a front-end framework, and you'll discover how to use it in detail.


You'll start with building the simplest Vue components and learning to use core features like data binding, props, events, and computed properties.


Then you'll build that knowledge step by step with practical projects learning how to use the Vue CLI, forms, watchers, and custom events.


You'll also master key concepts like the Vue router and the Composition API. By the end of this course, you'll be confident in using Vue.js for all your front-end development projects.



What You'll Learn



  • fundamentals of Vue with no build tools or toolchains 

  • create applications, define and use options, organize applications into components 

  • learn the toolchains

  • how to load and work with reactive data 

  • how to handle user input and create custom events 

  • manipulate style, create computed properties

  • define objects that watch your data for changes 

  • how to create single-page applications using the Vue router

  • how to use the Composing API 



Follow Along, Learn by Doing


I encourage you to follow along with this course, and you'll learn about all the most important features of Vue.js


To help, the Vue.js Tutorial: Beginner to Front-End Developer GitHub repository contains the source code for each lesson and the completed sample project that was built throughout the course. 




1. What You Will Learn 


Watch video lesson [0:00:00] ↗


Get an introduction to the course and an overview of what you'll be building.



2. Vue.js With no Tool-Chain


Getting Started With Vue


Watch video lesson [0:02:31] ↗


Vue.js is the most approachable UI framework, especially without using any tool-chains.




Here is the complete source code for a minimal, no-toolchain-required Vue.js hello world app.



















































































































1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
    <meta charset="UTF-8">
5
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
    <title>Vue Basics</title>
8
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
    <script src="https://unpkg.com/vue@3"></script>
10
</head>
11
<body>
12
    <div id="content" class="container">
13
        <h1>{{ pageTitle }}</h1>
14
        <p>{{ content }}</p>
15
    </div>
16

17
    <script>
18
        Vue.createApp({
19
            data() {
20
                return {
21
                    pageTitle: 'Hello, Vue',
22
                    content: 'Welcome to the wonderful world of Vue'
23
                };
24
            }
25
        }).mount('#content');
26
    </script>
27
</body>
28
</html>


Using Loops to Generate Content


Watch video lesson [0:10:51] ↗


Collections are some of the most common types of data you will work with within your application. In this lesson, you'll learn how to use the v-for directive to loop over collections to generate output.


Binding Data to Attributes


Watch video lesson [0:17:00] ↗


Data binding automatically keeps your components up to date with the underlying application data. See how it works in this lesson.



Here's an example of binding to data inside a loop.































1
            <ul>
2
                <li v-for="(link, index) in links">
3
                    <a 
4
                        :href="link.url"
5
                    >{{ link.text }}</a>
6
                </li>
7
            </ul>


Setting Up Events


Watch video lesson [0:25:11] ↗


Events are the lifeblood of any graphical application. You'll learn how to listen for DOM events in this lesson.


Binding CSS Classes I


Watch video lesson [0:33:15] ↗


Manipulating CSS is key to providing dynamic and enhanced user experiences. You'll learn how to bind CSS classes to state in this lesson.


Using Computed Properties


Watch video lesson [0:41:48] ↗


Sometimes you need to compute data on-the-fly in order to provide reactivity to your application. Computed properties give you that ability.


Binding CSS Classes II


Watch video lesson [0:48:05] ↗




There's more than one way to skin a cat... err bind CSS classes. You'll learn how to use arrays to do so in this lesson.




Introducing Components


Watch video lesson [0:55:00] ↗


Components help us organize our applications into smaller, maintainable pieces.


Understanding Data Flow


Watch video lesson [01:04:19] ↗


Components provide data to their children via props, and you'll need to understand how that data flows in order to build your applications.



Here's a snippet that shows how to create and register a new component with Vue.







































1
app.component('page-viewer', {
2
    props: ['page'],
3
    template: `

4
        <div class="container">

5
            <h1>{{page.pageTitle}}</h1>

6
            <p>{{page.content}}</p>

7
        </div>

8
    `
9
});



3. Using the Vue CLI


Getting Started With the Vue CLI


Watch video lesson [1:13:00] ↗


The Vue CLI makes it easy to get up and running with a full-blown project. You'll install the CLI and create a project in this lesson.





Current recommendations are to use create-vue with the Vite tooling for new Vue projects. vue-cli is in maintenance mode, but still works for creating Webpack-powered Vue apps like in this course.




Starting a Project From Scratch


Watch video lesson [1:21:30] ↗


We'll delete most of that fresh new project we created in order to start completely from scratch. It's good to practice these things!


Applying CSS to Components


Watch video lesson [1:32:18] ↗


Our applications are broken into smaller components, and those components need CSS. You'll learn how to provide CSS to your application and components.




4. Working With Data


Using the created() Lifecycle Event to Load Data


Watch video lesson [1:41:51] ↗


The created() lifecycle event works a lot like the browser's load event. It's a great time to fetch data and supply it to your component before it's rendered in the browser.



Here's an example of using the created lifecycle event to load page data from a remote server.















































































1
export default {
2
    //...

3

4
    created() {
5
        this.getPages();
6
    },
7
    data() {
8
        return {
9
            pages: []
10
        };
11
    },
12
    methods: {
13
        async getPages() {
14
            let res = await fetch('pages.json');
15
            let data = await res.json();
16
            this.pages = data;
17
        }
18
    }
19
}


Working With Unset Props


Watch video lesson [1:48:19] ↗


Sometimes our components are ready and available before they have data to work with. You'll learn how to handle those situations in this lesson.


Deciding When to Load Data


Watch video lesson [1:55:19] ↗


Some components depend upon their parent for data; others are independent and load their own. There are no hard and fast rules, so I'll show you some strategies for loading data.


Working With Forms


Watch video lesson [2:01:14] ↗


The primary way we work with user input is via forms. Vue makes it laughably easy to work with forms and their data.



Validating Forms


Watch video lesson [2:08:43] ↗


Did I mention Vue makes it easy to work with forms? That includes validation.


Updating and Filtering Data


Watch video lesson [2:14:39] ↗


Vue gives us the tools to get/provide data that our components need in order to function. That includes updating and filtering data.


Using Watchers


Watch video lesson [2:21:05] ↗


Watchers give us the ability to watch certain properties and react when their values change.



5. Creating and Using Custom Events


Creating Custom Events


Watch video lesson [2:25:19] ↗


Vue makes it easy to create custom events. You'll learn how in this lesson.


Writing a Global Event Bus


Watch video lesson [2:32:48] ↗


Unfortunately, custom events don't bubble, which makes it difficult for parent components to listen to events of children nested deep in the tree. Thankfully, we can create our own global event bus.



6. Using Vue Router


Introducing Vue Router


Watch video lesson [2:44:37] ↗


The Vue Router makes it possible to "navigate" between components... kind of like pages. You'll get the rundown in this lesson.



Here is a simple router with a couple of static routes.































1
const router = createRouter({
2
    history: createWebHashHistory(),
3
    routes: [
4
        { path: '/', component: PageViewer },
5
        { path: '/create', component: CreatePage }
6
    ]
7
});


Using Route Params


Watch video lesson [2:53:19] ↗


Components that handle routes don't get their data via props because they don't really have a parent. Instead, they rely on data from the URL via route params. You'll learn how to use them in this lesson.


Loading Data for Views


Watch video lesson [2:59:18] ↗




Because views don't get data from their non-existent parent, data has to be loaded from somewhere. A centralized data store could be your solution, and we'll build one in this lesson.




Watching Params to Reload Data


Watch video lesson [3:10:07] ↗


If we try to "navigate" to a view that is already loaded by the router, we have to reload the data for the new route. You'll learn how in this lesson.


Using the Router's Active Class


Watch video lesson [3:16:57] ↗


The router keeps track of the currently active link. You'll learn how to use it in this lesson (and clean up a lot of code!).


Nesting Routes


Watch video lesson [3:23:36] ↗


Routes, like components, can be nested. You'll learn how and why you might want to do so in this lesson. 



Here's an updated router with params and nested routes.































































1
const router = createRouter({
2
    history: createWebHashHistory(),
3
    routes: [
4
        { path: '/:index?', component: PageViewer, props: true },
5
        { 
6
            path: '/pages', 
7
            component: Pages,
8
            children: [
9
                { path: '', component: PagesList },
10
                { path: 'create', component: CreatePage }
11
            ]
12
        },
13
    ]
14
});
15




7. Using the Composition API


Introducing the Composition API


Watch video lesson [3:30:52] ↗


The Composition API was created to improve the organization of your component's code. I'll run over the basics in this lesson.



Providing and Injecting Dependencies Into Components


Watch video lesson [3:40:26] ↗


"Setup" components don't use this, and it complicates how we get to our global properties. Instead, we'll use Vue's provide and inject features to access our global objects.


Accessing Props and Router Functions


Watch video lesson [3:48:18] ↗


The Composition API changes how we access... everything, including props and the route/router. You'll learn how to access those in this lesson.


Binding Data and Working With Forms


Watch video lesson [3:54:58] ↗


In this lesson, you'll learn how to bind data to forms in setup components. It's easy.


Defining Computed and Watched Values


Watch video lesson [4:06:00] ↗


You can define computed and watched values in setup components. You'll learn how in this lesson.


Implementing the Delete Functionality


Watch video lesson [4:16:18] ↗


We'll finish off the management UI by providing delete functionality.



Conclusion


Watch video lesson [4:20:42] ↗




Vue.js is my favorite UI framework. And don't get me wrong—React, Angular, and all of the other frameworks do their job just fine. But there's something different about Vue. It's very easy to get started, and it lacks a lot of the wonky rules that seem to plague other frameworks.


It's my hope that by now, you have a firm grasp of Vue's fundamentals, and I hope you continue to use it in your current and future projects.





Vue Plugins and Templates 



CodeCanyon, Envato Elements, and ThemeForest are fantastic sources for Vue plugins and templates. They can help you save time, cut down on development costs, and deliver projects on time.




Original Link: https://code.tutsplus.com/tutorials/vuejs-tutorial-beginner-to-front-end-developer--cms-93747

Share this article:    Share on Facebook
View Full Article

TutsPlus - Code

Tuts+ is a site aimed at web developers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites.

More About this Source Visit TutsPlus - Code