美文网首页
vue-cli2的单页面应用构建

vue-cli2的单页面应用构建

作者: afeng_1234 | 来源:发表于2018-11-17 14:59 被阅读0次
    前提全局安装 vue-cli :
    npm install vue-cli -g
    

    创建项目

    vue init webpack my-project
    
    ? Project name (test)        // 项目名称
    ? Project name test
    ? Project description (A Vue.js project)        // 项目描述
    ? Project description A Vue.js project
    ? Author (villelee)        // 作者
    ? Author villelee
    ? Vue build (Use arrow keys)        // 开始选项设置
    ? Vue build standalone
    ? Install vue-router? (Y/n) Y        // 安装路由
    ? Install vue-router? Yes
    ? Use ESLint to lint your code? (Y/n) Y        // 是否使用ESlint统一代码风格
    ? Use ESLint to lint your code? Yes
    ? Pick an ESLint preset (Use arrow keys)
    > Standard (https://github.com/standard/standard)
    ? Pick an ESLint preset Airbnb
    ? Set up unit tests (Y/n) n        // 是否安装单元测试
    ? Set up unit tests No
    ? Setup e2e tests with Nightwatch? (Y/n) n        // 是否安装e2e测试
    ? 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? (recom
    mended) npm
    

    项目创建完成后,安装基础模块

    cd myproject;
    npm install;
    

    最后 运行

    npm run dev
    

    如果项目可以正常启动,即可继续安装vue的辅助工具(--save 也可以简写 -d)

    npm install vue-router --save (路由管理模块)
    npm install vuex --save (状态管理模块)
    npm install axios --save (网路请求模块)
    

    相关文章

      网友评论

          本文标题:vue-cli2的单页面应用构建

          本文链接:https://www.haomeiwen.com/subject/opzbfqtx.html