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   

 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:


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   


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. + vue-cli@2.9.6  
  2. added 238 packages from 205 contributors in 346.282s   


  3. 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.


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


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   

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.



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

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Blade Component to Render Markdown in Laravel
      Laravel Markdown   is a highly configurable markdown renderer and Blade component for Laravel by the folks at   Spatie : The package featu...
  • There are two solutions for one board, using different chips. But one of their i2c address is the same. How to resolve conflict in one dts?
    Two chips A and B conflict with 0x62 on i2c bus 10. If A@62 and B@62 are configured on dts, Linux loads the driver of A. If B@62 is in front...
  • Real-Time Chat Package for Laravel
      Chatify   is a Laravel package by   Munaf Aqeel Mahdi   that adds a complete real-time chat system to your application without any additio...
  • Using Laravel Model Factories in your tests
    Laravel Model factories are one of the best features you can use in your application when it comes to testing. They provide a way to define ...
  • Detecting .NET8 with Inno Setup and InnoDependenciyInstaller
    I am looking at using InnoDependencyInstaller and it has a function that it uses under the hood: Dependency_AddDotNet80 procedure Depend...

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