This article mainly introduces the detailed steps of creating a new VueJs project in VsCode. The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.
Use vue-cli to quickly build projects
( vue-cli is the scaffolding of vue.js, used to automatically generate vue.js template projects. Before installing vue-cli, you need to install vue and webpack first)
· node -v //(版本低引起:bash: npm: command not found) · npm -v //以上帮助检查是否安装 node npm · 输入vue,//测试vue是否安装成功 · 输入vue list //看vue中有哪些子类 npm install vue
npm install -g vue-cli //全局安装vue-cli vue init webpack projectName //生成项目名为projectName的模板,这里的项目名projectName随你自己写 (是的话 敲回车就行) //默认情况下,webpack安装的是最新版本的,如果要安装其他版本,使用命令行vue init webpack#1.0 ***就可以了。
You will be asked during installation:
①, Project name (sanfeng1); Project name (sanfeng1) . (Press enter to confirm, press N if not)
②、 Project description (A Vue.js project); Project description (A vue.js project). (Feel free to enter a short introduction in English)
③, Author (sunsanfeng); Author (sunsanfeng). (Press enter to confirm, press N if not)
④、Vue build (Use arrow keys)> Runtime + Compiler: recommended for most usersRuntime-only: about 6KB lighter min+gzip, but templates ( or any Vue-specificHTML) are ONLY allowed in .vue files - render Functions are required elsewhere; Vue build (use arrow keys) > Runtime + Compiler: Most users recommend runtime: ~6kb + gzip , but templates (or any Vue specific HTML) are only allowed in . VUE file rendering functionality is required elsewhere. (Press enter)
⑤、Install vue-router? (Y/n);Installed route? (/N). (You can install it or not, you can install it again later, choose according to your needs)
⑥, Use ESLint to lint your code? (Y/n); Use ESlint syntax? (Y/N). (When using ESLint syntax, you must be mentally prepared. Unless you understand ESLint syntax very well, you will report errors everywhere. I have been driven crazy. I recommend N)
⑦、Setup unit tests with Karma + Mocha? (Y/n);Set up unit tests? (Y/N). (Choose N)
⑧、Setup e2e tests with Nightwatch? (Y/n);Nightwatch establishes end-to-end tests? (Y/N). (Choose N)
cd projectName // ctrl+c 结束并进入文件目录 npm install //初始化安装依赖 npm run dev //最后执行 //在浏览器打开http://localhost:8080,则可以看到欢迎页了。
But this can only be run locally. How can we access it on our own server?
You need to execute at this time:
· npm run build //会生成静态文件,在根目录的dist里,里面有个index.html,这是服务器访问的路径指定到这里就可以访问我们自己的项目了。
Note: Taobao mirror statement, npm is faster after installation. When using it, just change npm to cnpm:
$ npm install -g cnpm –registry=https://registry.npm.taobao.org //or # 建议不要用cnpm 安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题 $ npm install –registry=https://registry.npm.taobao.org
But I found a problem that the reference path of css and js referenced in generated index.html is wrong. At this time, I need to modify the configuration myself.
Enter config/index.js
The reference path of the original configuration is
I Change it to
so that you can access it normally.
tips:
1. Several ways to install npm:
$ npm i 或 $ cnpm i 或 $ npm i cnpm -g (cnpm更快) 或 $ npm install -g cnpm --registry=https://registry.npm.taobao.org //[镜像文件](http://riny.net/2014/cnpm/),提升速度
2. How to update npm to the latest version ?
npm install -g npm //但是,我尝试之后 查看npm当前版本 //npm -v //显示的仍然是当前版本。 //npm 还有个命令是 update, 于是看了下官方文档: //npm update [-g] [<pkg>...] //于是尝试使用该命令: //npm update -g npm //之后仍然是无效。
Finally go to npm's official website
and find the following command:
npm install npm@latest -g //可以更新npm至最新版本
After the @ symbol, you can add the version number you want to update to.
3. Run the vue project:
$ npm run dev or vsCode View the integrated terminal and enter the above command
Related recommendations:
Detailed examples of VSCode configuration React Native development environment
Detailed examples of vue-cli vscode configuration eslint
Summary and organize VsCode plug-in
The above is the detailed content of VsCode completes the tutorial of VueJs project. For more information, please follow other related articles on the PHP Chinese website!

去掉重复并排序的方法:1、使用“Array.from(new Set(arr))”或者“[…new Set(arr)]”语句,去掉数组中的重复元素,返回去重后的新数组;2、利用sort()对去重数组进行排序,语法“去重数组.sort()”。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于Symbol类型、隐藏属性及全局注册表的相关问题,包括了Symbol类型的描述、Symbol不会隐式转字符串等问题,下面一起来看一下,希望对大家有帮助。

怎么制作文字轮播与图片轮播?大家第一想到的是不是利用js,其实利用纯CSS也能实现文字轮播与图片轮播,下面来看看实现方法,希望对大家有所帮助!

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于对象的构造函数和new操作符,构造函数是所有对象的成员方法中,最早被调用的那个,下面一起来看一下吧,希望对大家有帮助。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于面向对象的相关问题,包括了属性描述符、数据描述符、存取描述符等等内容,下面一起来看一下,希望对大家有帮助。

方法:1、利用“点击元素对象.unbind("click");”方法,该方法可以移除被选元素的事件处理程序;2、利用“点击元素对象.off("click");”方法,该方法可以移除通过on()方法添加的事件处理程序。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于BOM操作的相关问题,包括了window对象的常见事件、JavaScript执行机制等等相关内容,下面一起来看一下,希望对大家有帮助。

foreach不是es6的方法。foreach是es3中一个遍历数组的方法,可以调用数组的每个元素,并将元素传给回调函数进行处理,语法“array.forEach(function(当前元素,索引,数组){...})”;该方法不处理空数组。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
