首页 > 其他 > 详细

CLI

时间:2019-08-02 17:02:42      阅读:128      评论:0      收藏:0      [点我收藏+]

cli是vue提供的一个用来快速构建项目环境的一个工具,底层使用的是webpack

cli的安装 npm/cnpm/yarn 都可以使用

使用国内镜像加速npm和yarn
npm config set registry=https://registry.npm.taobao.org
yarn config set registry https://registry.npm.taobao.org
下载cnpm:npm install -g cnpm registry=https://registry.npm.taobao.org

创建项目

cli3版本创建

        命令创建 【 推荐 】  vue create 项目名称

  图形界面创建  vue ui

cli2版本创建

  1. 标准版  vue init webpack 项目名称
  2. 简易版  vue init webpack-simple 项目名称
异步组件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <div id="app"> <Hello></Hello> </div> </body> <script src="../../lib/vue.js"></script> <script> Vue.component(‘Hello‘, function (resolve, reject) { setTimeout(function () { resolve({ template: ‘<div>I am async!</div>‘ }) }, 1000) }) new Vue({ el: ‘#app‘ }) </script> </html>


CLI

原文:https://www.cnblogs.com/yangjin0514/p/11289729.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!