一、先安装node

vue是基于node的,所以先必须安装node(推荐安装8左右的)

node下载地址(https://nodejs.org/zh-cn/

二、安装vue-cli

1、先全局安装(由于国内镜像较慢建议使用淘宝镜像)

先安装淘宝镜像

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

再安装vue-cli

cnpm install -g vue-cli

安装成功 

告知可以使用哪些模板

 2、初始化一个项目

sell是你项目名字 

vue init webpack sell

 

讲解每步意思

  • vue init webpack project-name(项目名字)
  • ? Project description (A Vue.js project) vue-cli新建项目(项目描述)
  • ? Author (XXXX <XXXX@XXX.com>) ;XXXX@XXX.com(项目作者)
  • ? Vue build 
    ❯ Runtime + Compiler: recommended for most users 
    Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY allowed in .vue files - render functions are required elsewhere

    这里选择Runtime + Compiler: recommended for most users;
  • ? Install vue-router? (Y/n) y 是否使用vue-router;
  • ? Use ESLint to lint your code? (Y/n) y 是否使用ESLint;
  • ? Pick an ESLint preset (Use arrow keys) 
    ❯ Standard (https://github.com/feross/standard) 
    Airbnb (https://github.com/airbnb/javascript) none (configure it yourself)
     这里选择Standard (https://github.com/feross/standard)
  • ? Setup unit tests with Karma + Mocha? (Y/n) n 是否需要单元测试;
  • Setup e2e tests with Nightwatch? (Y/n) n是否需要单元测试;

使用方法

3、使用

cd sell

npm run dev

4、成功

Logo

前往低代码交流专区

更多推荐