In your v-popup.vue, you can do the following:
<template>
<div class="overlay">
<div :class="['popup', popupClass]">
<slot></slot>
</div>
</div>
</template>
<script>
export default {
// Do the usual implementations here...
props: {
popupClass: ''
}
}
</script>
Then in your parent component, you can do the following:
<template>
<v-popup popup-class="custom-popup">
Popup content
</v-popup>
</template>
However, I am curious. Why not encapsulate this class inside v-popup.vue. I seldom use this design unless there will be another component sharing this class from the parent.
EDIT (per your last comment):
You can use this link as a reference on how to use the $attr attribute: https://jsfiddle.net/changjoo_park/pzx08wp9/
So, in a sense, you can do the following, in your parent component
<template>
<v-popup popup-class="custom-popup" v-bind="$attrs">
Popup content
</v-popup>
</template>
In your v-popup component:
<template>
<div class="overlay">
<div :class="['popup', $attrs.popupClass]">
<slot></slot>
</div>
</div>
</template>
<script>
export default {
// Do the usual implementations here...
}
</script>
So, no props implementations and the class is taken directly from the $attrs object. Hope this helps! You can read more about this usage here: https://v2.vuejs.org/v2/api/#vm-attrs