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