v-slot="slotProps" in vue code example

Example 1: v-slot="slotProps" in vue

<template> 
	<div class="message">   
		<slot :firstName="firstName"></slot> 
	</div>
</template><script>
export default {  name: "MyMessage",
data() {    return {      firstName: "Luca",    };  
},};
</script>

<style scoped>
.message {  color: red;  text-decoration: underline;}
</style>



<template>
  <my-message>
    <template v-slot="slotProps">
      <h1>Hey {{ slotProps.firstName }}, NotOnlyCSS is awesome!</h1>
    </template>
  </my-message>
</template>
<script>
import MyMessage from "./components/MyMessage.vue";
export default {
  name: "App",
  components: {
    MyMessage,
  },
};
</script>

Example 2: v-slot

<base-layout>
  <template v-slot:header>
    <h1>Here might be a page title</h1>
  </template>

  <p>A paragraph for the main content.</p>
  <p>And another one.</p>

  <template v-slot:footer>
    <p>Here's some contact info</p>
  </template>
</base-layout>

Tags:

Misc Example