Detailed explanation of Vue components and data transfer

小云云
Release: 2018-01-29 13:10:13
Original
2066 people have browsed it

In this article, we will introduce the Vue series (3) in detail to you: components and data transfer, routing, single file components, vue-cli scaffolding, hoping to help you.

1. Component component

1. What is a component?

组件(Component)是 Vue.js 最强大的功能之一。组件可以扩展 HTML 元素,封装可重用的代码 组件是自定义元素(对象)
Copy after login

2. How to define components

方式1:先创建组件构造器,然后由组件构造器创建组件 方式2:直接创建组件
Copy after login

Copy after login

Definition of components

3. Classification of components

分类:全局组件、局部组件
Copy after login

Copy after login

Classification of components

4 . Reference template

将组件内容放到模板