v-slot vue2.6新增指令使用指南


 
抽离的子组件
<template>
  <div class="wrapper">
    <slot name="demo"  :msg="msg" text="this is a slot demo , ">this is demo slot.</slot>
  </div>
</template>

<script>
  export default {
    components: {},
    props: {},
    data() {
      return {
        msg: 'nmb'
      }
    },
    watch: {},
    computed: {},
    methods: {},
    created() {},
    mounted() {}
  }
</script>
<style lang="scss" scoped>
.wrapper {
}
</style>

  

某组件内使用抽离组件
   <father>
          <template v-slot:demo="scope">
            sb
            <p>{{ scope.text }}{{ scope.msg }}</p>
          </template>
        </father>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM