美文网首页
2019-04-24

2019-04-24

作者: 雪妮爸爸 | 来源:发表于2019-04-24 17:15 被阅读0次

html

  1. HTML <!DOCTYPE> 标签

css

  1. flex

vue

  1. vm.$emit用法
vm.$emit(event, arg )
  • $emit 绑定一个自定义事件event,当这个这个语句被执行到的时候,就会将参数arg传递给父组件,父组件通过@event监听并接收参数。
<template>
 <div>
  <h1>{{title}}</h1>
  <child @getMessage="showMsg"></child>
 </div>
</template>
 
<script>
 import Child from '../components/child.vue'
 export default {
  components: {Child},
  data(){
     return{title:''}
  },
  methods:{
   showMsg(title){this.title=title;}
     }
 }
</script>
<template>
 <h3>我是子组件!</h3>
</template>
<script>
 export default {
  mounted: function () {
   this.$emit('getMessage', '我是父组件!')
  }
 }
</script>
  1. watch
  2. props
  • 默认值设置
  • props down, events up
    父组件通过 props 向下传递数据给子组件;子组件通过 events 给父组件发送消息。

javascript

  1. avaScript unshift() 方法

scrolltolower事件

相关文章

网友评论

      本文标题:2019-04-24

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