作用域插槽 向父组件传递 <template slot-scope="{ row, index }" slot="dateNo">

作用域插槽 向父组件传递 <template slot-scope="{ row, index }"  slot="dateNo"> 

slotTest1

<slot name="action" :kk="kk"></slot>

slotTest2

<!--
* @description text
!-->
<template>
    <div>
      <slot-test1>
        <template slot-scope="{ kk }" slot="action">
          <slot name="action" :kk="kk"></slot>
          111 {{kk}}
        </template>
          </slot-test1>
    </div>
</template>

<script>
import slotTest1 from './slotTest1'
export default {
  name: 'slotTest',
  components: {
    slotTest1
  },
  props: {},
  data () {
    return {}
  },
  watch: {},
  computed: {},
  methods: {},
  created () {
  },
  mounted () {
  }
}
</script>
<style lang="less" scoped>
</style>

父组件调用

<slot-test2>
      <template slot-scope="{ kk }" slot="action">
        666 {{kk}}
      </template>
    </slot-test2>

 

posted @ 2019-05-16 18:57  彭成刚  阅读(7397)  评论(0编辑  收藏  举报