How to develop your own vue project from scratch and create your first engineered front-end project

Original address: How to develop your own vue project from scratch, and build your first engineered front-end project, vue-admin project, from scratch? _Vue_Learning is endless_Guangzhou website building Xiaodai BOTAO blog

Develop vue projects from scratch


Many people want to learn decentralized development (I don’t know if the term is correct) but have no way to start. npm, vue, nodejs, and various names, operating environments, how to install, and how to configure various problems arise. My head is spinning but I still don’t understand it. If I don’t  pay the fees in a systematic way , I will have to take  a lot of detours . There is no way around it. Next, we will make a vue-admin project directly to get started with this kind of separated development, typesetting, and how nodejs works.

Next, let’s start learning together.

Note: The version of vue and vue-cli, the article needs to be updated, it is for reference only. If you need to learn together, you can join the Q group: 687361645

Prerequisites


1. Install nodejs. Go to the nodejs official website to download and install it.

Enter  node -v  and  npm -v to check the version number. If it is displayed, the installation is successful.

image.png

2. Install the code editor  Visual Studio

image.png

3. Use the command line tool that comes with vsCode or use  Git

Initialize project or create project


1. Initialize the project through the following command

Run the command to generate a configuration file package.json

npm init -y

How to develop your own vue project from scratch and build your first engineered front-end project, vue-admin project, from scratch?

2. Install the packaging tool webpack

Need to install webpack and webpack cli

 npm install -D webpack webpack-cli

If the installation fails, please install one by one

npm install --save-dev webpack
npm install --save-dev webpack-cli

3. Create project entrance


1. Create index.html file

2. Create a new src folder and create main.js as the main entry file of the project.

     main.js function:

           1. Create a vue root example, which is similar to importing the initial file

           2. Mounting App components means introducing the public modules you need.

3、index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue-admin</title>
</head>
<body>
    <div id="app"></div>
</body>
</html>

4、main.js

//Import vue object from vue package
import Vue from 'vue'

new View({
    the: '#app'
})

5. The specific directory structure after completion

vue-admin
├─ package-lock.json
├─ package.json
├─ public
│ ├─ favicon.ico
│  └─ index.html
└─ src
   └─ main.js

Note: How to check which packages have been installed globally using npm -g?

Continuously updating...

Guess you like

Origin blog.csdn.net/qq_29639425/article/details/121181304