zoukankan      html  css  js  c++  java
  • Vue项目搭建过程

    环境搭建: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 
    注:主要用的包都在package.json文件中
    安装依赖 $ npm install
    注:会发现多了一个node_modules目录,,里面就是项目依赖包资源 运行项目 $ 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

     

  • 相关阅读:
    RTOS双向链表数据结构
    [LintCode] Majority Number(以时间复杂度O(n)求主元素)
    [LintCode] Median(期望时间复杂度O(n)求中位数和第k大数)
    [LintCode]unique paths with obstacles
    [LintCode]unique paths
    [LintCode]sqrt(x)
    排序算法(C++实现)
    优先队列C++实现
    散列之分离链接法
    AVL树C++实现
  • 原文地址:https://www.cnblogs.com/zhaojinxin/p/7681967.html
Copyright © 2011-2022 走看看