子组件
<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>