In my SPA I have a v-card
with a v-card-title
.
v-card-text
is compound of many other component / text and a close button with a lot of logic and properties.
Is there a way to create a custom component (something like my-card-text
) which automatically includes the commond part and the button which are always the same?
I'd like to write something like:
<v-card>
<my-card-text>
<something/>
<a>a link</a>
<v-btn>OK</v-btn>
</my-card-text>
</v-card>
Is it possible to write code in custom component?
Yes, it is definitely possible. You can use slots for the contents that need to be passed along. If you want custom behavior (on a click for example), you can also emit events using $emit to the parent component.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.