Broken read ———— remember the beginning of the vue when in a hurry, also don’t know what to do, step by step to try to come over, this re-write a new function, by the way to write a complete point of the process, just for the entry of a reference, there is a general understanding
The body — –
Three steps to quickly build a project using VUE-CLI
-
First make sure you have the Node environment installed and NPM is available
-
-
Check node version: Enter CMD
node -v Copy the code
-
Check the NPM version: Enter in CMD
node -v Copy the code
Then, it’s time to actually create the project
-
Global installation vUE – CLI
npm i vue-cli -g` Copy the code
-
After the installation is completed, enter your own folder, of course, you CD in or mouse point in or, this is not important. Just go in.
Use the command to initialize and create your own project.
vue init webpack test Copy the code
(The test is the name of the project you want to create.)
? Project name (exprice) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - the Project name? Project Description (A vue.js Project)----------- Author Datura --------------------- Project Author? Install vue-router? Yes ? Use ESLint to lint your code? (Y/n) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- whether to enable eslint detection rules, no personal advice here? Setup unit tests with Karma + Mocha? (Y/n) no ? Setup e2e tests with Nightwatch? (Y/n) no vue-cli · Generated "test". To get started: -----------Copy the code
-
Ok, when you see this, the installation is successful, according to the above prompts command, continue to enter the new project, CD into
And then they run, and they’re done.
It’s time to look at your own directory structure.
(In fact, I have screenshots, but it is too long to clean the computer, so it is gone, I am too lazy to cut side, just the text, feeling quite clear, after all, it was written a long time ago in the computer saved not sent)
And then here’s an official example that’s ready to run, but if you’re new to it you might be a little confused about where to start. Don’t panic. There’s more to come
1. Create a folder under SRC < create the corresponding directory structure for your files > mine
2. Configure the route in router — index.js
import Vue from 'vue' import Router from 'vue-router' import Home from '@/views/home/index.vue' Vue.use(Router) export default new Router({ routes: [{ path: '/', name: 'Invite', component: Invite }, { path: '/invite', name: 'Invite', component: Invite}]}) send a meaning version of my index.js(fragment, focus on step)Copy the code
2. Jump between pages to test content in vUE
Basically here is ok, to put their own content inside good
3. Added: Cs-loader style-loader vue-style-loader then NPM I Cs-loader style-loader vue-style-loader -s installation will do
The editor I used was VS Code and when NPM start in order for the browser to open itself, I can configure it as follows
Pack. Json in dev, open “dev” : “webpack dev – server – open – the inline – progress — config build/webpack. Dev. Conf., js”,
The annoying thing is that every time you open the project, it opens itself…