vue中attributes, methods ,events ,slots解释

随便写写

attributes

html属性

<input type="textarea"></input>

type 就是属于attributes,html的属性,在vue中可以使用绑定 :type 来动态渲染html属性

slots

插槽,可以看一下官网,分为匿名插槽,具名插槽,作用域插槽

参考: https://cn.vuejs.org/v2/guide/components-slots.html

          https://juejin.im/post/5a69ece0f265da3e5a5777ed

Events

自定义事件

<input @change="changeA"></input> 的@change

Methods

用户事件

感觉events 和 methods的区别就类似于 emit 和 on 的作用



猜你喜欢

转载自blog.csdn.net/shentibeitaokong/article/details/80398801
今日推荐