Can different element contents be placed in vue custom components?

problem description

suppose I create a vue project, in which I create a component (page) A _ Magi B, and then I create a container component C ~ ~ C is just a container. I refer to C in An and B respectively, but I hope that C in AB is not the same component. For example, in A, I want to reference C container components with text and pictures, and then in B, I want to reference C components with forms. Maybe there will be DMAE in the future. The page, I want the common C component, only takes on the container function and has the inherent CSS style. But the HTML elements placed in it are different, is this allowed?

related codes

/ / Please paste the code text below (do not replace the code with pictures)

<cont>
        <div>
        </div>
    </cont>

CONT is a custom component I wrote. It is not allowed to write like this. Is there any good way to write it? Of course, I know that we can use the public class name + DIV to achieve the effect of the container, but this is not the situation I want, do you have any other way?


ide/components-slots.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.


Hello, landlord! You can use slot API provided by vue . For specific usage, please refer to the document ide/components-slots.html" rel=" nofollow noreferrer "> Portal . Based on the requirements, give a simple example:

<template>
    <div>
       <slot></slot>
    </div
</template>  

<script>
  export default {
    name: 'Cont'
  }
</script> 
Menu