vue基础

一、创建Vue工程


 

使用webpack脚手架创建工程:

1、vue init webpack  ”项目名称“

 发现报了错:

vue-cli · Failed to download repo vuejs-templates/webpack: self signed certificate in certificate chain

VUE CLI.下载VUEJS模板/WebPACK失败:证书链中的自签名证书

所以使用离线的方式生成:

发现没有webpack-simple

需要手动下载 webpack-simple 模板 ,进入到 https://github.com/vuejs-templates/ ,选择 webpack-simple 下载到本地

C:Users用户名.vue-templates这个文件夹下面

 就可以创建工程啦

2、按提示操作

 先cd vue.test

继续执行下面命令

 项目搭建成功!!!

3.引入element-ui

使用npm进行安装
npm i element-ui -S

在main.js中完全引入
import ElementUI from 'element-ui';
Vue.use(ElementUI);

 二、组件的注册和使用


 

 

原文地址:https://www.cnblogs.com/anyanpeng/p/14886353.html