您的位置:首页 > 产品设计 > UI/UE

vue 开发环境搭建

2017-03-13 11:25 232 查看

安装node.js

(http://www.runoob.com/nodejs/nodejs-install-setup.html)

安装淘宝镜像

npm install -g cnpm --registry= https://registry.npm.taobao.org[/code] 

在用 Vue.js 构建大型应用时推荐使用 NPM 安装:

# 最新稳定版
$ cnpm install vue


安装webpack

cnpm install webpack -g


安装vue脚手架

npm install vue-cli -g


在硬盘上找一个文件夹放工程用的,在终端中进入该目录

cd 目录路径

Vue.js 提供一个官方命令行工具,可用于快速搭建大型单页应用。

# 全局安装 vue-cli
$ cnpm install --global vue-cli
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
# 这里需要进行一些配置,默认回车即可
This will install Vue 2.x version of the template.

For Vue 1.x use: vue init webpack#1.0 my-project

? Project name my-project
? Project description A Vue.js project
? Author runoob <test@runoob.com>
? Vue build standalone
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? Yes

vue-cli · Generated "my-project".

To get started:

cd my-project
npm install
npm run dev

Documentation can be found at https://vuejs-templates.github.io/webpack[/code] 

进入项目,安装并运行:

$ cd my-project
$ cnpm install
$ cnpm run dev
DONE  Compiled successfully in 4388ms

> Listening at http://localhost:8080[/code] 

成功执行以上命令后访问 http://localhost:8080/,输出结果如下所示:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息