码迷,mamicode.com
首页 > 其他好文 > 详细

Vue项目搭建过程

时间:2017-10-17 16:30:29      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:ber   ajax   bpa   dev   工具   请求   node   post   outer   

 

环境搭建:mac+nodejs+npm

#安装node.js :                      $ brew install node   
#安装vue-cil:                       $ npm install -g vue-cli
注:
官网下载安装node.js:https://nodejs.org/en/
mac-使用brew安装软件

 

优化:

使用国内镜像提升下载速度:
    $ npm install -g cnpm --registry=https://registry.npm.taobao.org
    $ cnpm install -d
安装 nrm 自由切换 npm 源    $ cnpm install nrm
使用nrm:
    $ nrm ls 
    $ nrm use **

 

构建项目:

安装vue                $ npm install vue@2.1.6 
全局安装 vue-cli        $ npm install --global vue-cli 
创建新项目              $ vue init webpack my-project 
进入项目目录            $ cd my-project 
安装依赖                $ npm install 
运行项目                $ npm run dev
打包项目           $ npm run build
测试打包项目:
  安装一个 http-server 服务 $npm install http-server -g
   使用:cd dist     http-server -p 3000

注意:

去掉打包时生成的 map 文件:/config/index.js 文件修改为:productionSourceMap: false


安装组件:

安装 vue 路由模块      $ npm install vue-router -D 
安装网络请求模块        $ npm install vue-router vue-resource --save
支持scss 文件预编译 
             $ npm install sass-loader -D
             $ npm install node-sass -D
支持jquery $
npm install --save jquery 安装一个ajax接口请求工具 $ npm install axios -D

 

Vue项目搭建过程

标签:ber   ajax   bpa   dev   工具   请求   node   post   outer   

原文地址:http://www.cnblogs.com/zhaojinxin/p/7681967.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!