美文网首页程序员
Vue CLI新旧版本的使用

Vue CLI新旧版本的使用

作者: 家里有棵核桃树 | 来源:发表于2020-05-09 18:29 被阅读0次

Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统。目前有两种版本的脚手架。

1、vue-cli(旧版本)

安装环境:Node.js (>=6.x, 8.x preferred), npm version 3+ and Git

  • 安装
    npm install vue-cli -g
  • 查看版本号
    vue -V
  • 卸载
    npm uninstall vue-cli -g
  • 创建vue项目
    vue init <template-name> <project-name>
    两种常用的模板类型: webpack-simple webpack
    如:vue init webpack my-project
  • 安装依赖包
    npm install
  • 启动
    npm run devnpm start
  • 打包
    npm run build

2、@vue/cli(新版本-推荐)

安装环境:Node.js 8.9 或更高版本 (推荐 8.11.0+)

  • 安装
    npm install @vue/cli -g
  • 查看版本号
    vue -V
  • 卸载
    npm uninstall @vue/cli -g
  • 使用 vue serve 和 vue build 命令对单个 *.vue 文件进行快速原型开发
    npm install @vue/cli-service-global -g
  • 创建vue项目
    • vue ui 通过图形化页面创建
    • vue create <peoject-name> 通过命令行创建 参考
  • 启动
    npm run serve
  • 打包
    npm run build

相关文章

网友评论

    本文标题:Vue CLI新旧版本的使用

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