CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

28 December, 2020

Vue.js Tutorial

 Programing Coderfunda     December 28, 2020     Vue.js Tutorial     No comments    Image

 Vue.js Installation

Compatibility Check

Before going to install and use Vue.js in your project, you should check the compatibility issues. Vue does not support IE8 and below versions of IE, because it uses ECMAScript 5 features not supported in IE8. It supports all the ECMAScript 5 compliant browsers.

How to install Vue.js?

There are several methods to use Vue.js. You can install it by going to its official site or can start using the Vue.js file from the CDN library also. Here, we are going to discuss some ways on how to install and use Vue.js in your project.

By using the <script> tag directly in HTML file

If you want to use the <script> tag of Vue.js directly in your HTML file then you have to download it from the official website.

  1. <html>  
  2.    <head>  
  3.       <script type = "text/javascript" src = "vue.min.js"></script>  
  4.    </head>  
  5.    <body></body>  
  6. </html>  

Let's go ahead to the official website of Vue.js https://vuejs.org/v2/guide/installation.html and download the vue.js according to your requirement. Here, you will get two versions of Vue.js to use- development version and production version.

The following image shows both versions:

Image


The development version is best to use in your project because it is not minimized, and helps you with the warnings and debug mode during the development of the project. On the other hand, the production version is minimized, as shown in the above screenshot.

Vue.js recommends that you not use the minified version during development because it doesn't show the warnings for common mistakes during the development of the project.

By Using CDN

You can also use the Vue.js file from the CDN library in your application. Use this link https://unpkg.com/vue within <script> element in your application, and you will get the latest version of Vue.js.

Example 1:

  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4.   <title>My first Vue app</title>  
  5.   <script src="https://unpkg.com/vue"></script>  
  6. </head>  
  7. <body>  
  8.   <div id="app">  
  9.     {{ message }}  
  10.   </div>  
  11.   <script>  
  12.     var app = new Vue({  
  13.       el: '#app',  
  14.       data: {  
  15.         message: 'Vue.js example with CDN'  
  16.       }  
  17.     })  
  18.   </script>  
  19. </body>  
  20. </html>  

Output:

Vue.js example with CDN 

You can also get Vue.js on jsDelivr (https://cdn.jsdelivr.net/npm/vue/dist/vue.js) and cdnjs (https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.0/vue.js).

Example 2:

  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4.   <title>My first Vue app</title>  
  5. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>    
  6. </head>  
  7. <body>  
  8.   <div id="app">  
  9.     {{ message }}  
  10.   </div>  
  11.   <script>  
  12.     var app = new Vue({  
  13.       el: '#app',  
  14.       data: {  
  15.         message: 'Vue.js second example with CDN'  
  16.       }  
  17.     })  
  18.   </script>  
  19. </body>  
  20. </html>  

Output:

Vue.js second example with CDN 

By Using NPM

NPM is recommended to use if you want to make a large scale application with VueJS. Use the following command to install the Vue.js using the npm package. It comes with Browserify and Webpack, along with other necessary tools that make development easy.

  1. npm install vue   

Note: Don't use this method if you are not yet familiar with Node.js-based build tools.

By Using CLI Command Line

You can also install Vue.js by using CLI and get started with the server activation. Use the following command to install Vue.js using CLI:

  1. npm install --global vue-cli   

Image

It will take a few minutes to install Vue.js cli. Once it is done, it will show the CLI version for Vue.js.

  1. + [email protected]  
  2. added 238 packages from 205 contributors in 346.282s   
  3. Image


  4. Create a project using Webpack

    Use the following command to create a project using Webpack. Here, we are going to create a project named "my_project".

    1. vue init webpack my_project   

    During this process, you will be asked to type Y/n. type Y and proceed further. It will automatically download the template and all dependencies.

Image

After creating your project successfully, you will see a message like the following screenshot.

Image

Start the project and Server

  • Now, the project is created. Go to the project directory by using the following command:
  1. cd my_project  
  • Use the following command to start the Server:
  1. npm run dev   
Image

You can see that after running the npm run dev command, the Server is started. Now, open the compatible browser i.e., Google Chrome, and run the localhost http://localhost:8080/#/ to open your project.

Image


  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Image
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Is there a way to use awk to count the number of rows between 2 flags and input that number into a specific field?
    I have a set of data that consists of seismic wave travel times and their corresponding information (i.e. source that produced the wave and ...
  • Vue.js Events
      In Vue.js, Events are used to respond to an action. Suppose, you have to build a dynamic website using Vue.js then you'll most likely ...
  • How to use Filament 3 with Laravel 11 | Beginner Course
    How to install filament 3 from scratch with Laravel 11. submitted by /u/Tilly-w-e [link] [comments]
  • Use Leaflet.js and Google Maps Blade Components in Laravel
      Laravel Maps   is a package to easily create maps using   Leaflet.js   or Google Maps and Blade components. The main features that work wi...
  • How to upload image file in Database by codeigniter
    CodeIgniter Image and File Upload public function insertblog () { $title = $this->input->post('title'); $author = $...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (69)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (4)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda

Advertisement