右键打开git(打开cmd也可以)
检查版本 检查 git 版本:git –version检查 npm 版本:npm -v (需要在6.9以上)检查 node 版本:node -v (需要在3.10以上) 安装 vue 输入命令: npm install –global vue-cli
安装完成后检查版本:vue –version
到这里vue开发的基础环境即搭建完毕。下面我们尝试创建个vue项目试试 :)
开始第一个vue项目首先在磁盘中创建一个用来存放我们的vue项目的文件夹,然后 cd 到我们所建的文件夹中(我建的文件夹叫做 ‘vue’)
创建项目输入:vue init webpack my-project
输入命令之后,将自动创建一个基于webpack模板的新项目,在这一过程中会要求你为这个新项目设置一些基础配置(项目名,作者等等),配置如下:
rbuli@service MINGW64 /g/vue$ vue init webpack my-project? Project name (my-project) hellovue? Project name hellovue? Project description (A Vue.js project) myvueproject? Project description myvueproject? Author (rbuli <xinleiwork@126.com>)? Author rbuli <xinleiwork@126.com>? Vue build standalone? Install vue-router? (Y/n) y? Install vue-router? Yes? Use ESLint to lint your code? (Y/n) n? Use ESLint to lint your code? No? Set up unit tests (Y/n) n? Set up unit tests No? Setup e2e tests with Nightwatch? (Y/n) n? Setup e2e tests with Nightwatch? No? Should we run `npm install` for you after the project has been created? (recom? Should we run `npm install` for you after the project has been created? (recommended) npm vue-cli · Generated "my-project".# Installing project dependencies ...# ======================== 安装依赖cd my-project(打开目录)
npm install (安装依赖)
p.s:如果上面出现了“? Should we run npm install for you after the project has been created? (recom
mended” 则不需要执行这条命令
npm run dev (运行)
等待启动完成
使用浏览器访问项目地址: http://localhost:8080 (默认地址)
hello,vue :)
开始你的vue之旅!
一些vue开发的配置 使用 VSCode 进行vue开发vscode 传送门,点击连接选择适合你的版本进行下载安装。 安装插件 打开 VSCode
输入组合键:Ctrl + P
输入:ext install vetur
回车
安装完成后还需要进行一点配置:
"emmet.syntaxProfiles": { "vue-html": "html", "vue": "html"}打开 Settings.json:
左上角单击 文件 >> 首选项 >> 设置
直接粘贴上去保存关闭就ok了
以上是安装插件的示例。
ps:贼麻烦,最后我继续使用HBulider进行开发:P HBuilder用了就不回去了 /感动得哭泣
可以参考这一篇博文,进行vscode插件的安装和配置。
参考这篇文章进行vue开发相关插件的安装与配置
资料参考链接:
Vue.js
Vue.js脚手架安装
优雅地使用 VSCode 来编辑 vue 文件优雅地使用 VSCode 来编辑 vue 文件
Vue2.0 搭建Vue脚手架(vue-cli)
VS Code使用之基本设置与配置详解