作用域插槽 向父组件传递 <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>
原文地址:https://www.cnblogs.com/pengchenggang/p/10877404.html
时间: 2024-10-11 02:32:20