Updated response:
If I understand correctly, one way to solve it, is you create the component Color within the "parent" component, i.e., for nay create a new file/separate component for the component Color. In the tag style you place the classes normally, as if they were for the "Father" component, but they are being used exclusively in the "Son" component, example:
Component "Pai"
<template lang="pug">
div
color(:row="{ color: 'red' }")
</template>
<script>
import Vue from 'vue'
Vue.component('color', {
props: ['row'],
template: '<div class="badge-color" :style="{backgroundColor: this.row.color}"><p>teste</p></div>'
})
</script>
<style lang="stylus">
.badge-color
width 100%
</style>
Another way to accomplish, is to put Global in your file main.js
or other configuration file, example:
main.js
import Vue from 'vue'
import App from '@/App'
import router from '@/router'
import store from '@/store'
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
template: '<App/>',
components: { App }
})
Vue.component('color', {
props: ['row'],
template: '<div class="badge-color" :style="{backgroundColor: this.row.color}"><p>teste</p></div>'
})
And in your component you want to use the component Color, you call it normally, and insert the same way css into your tag style, example:
"Parent" component using the Color component globally
<template lang="pug">
div
color(:row="{ color: 'red' }")
</template>
<script>
// código
</script>
<style lang="stylus">
.badge-color
width 100%
</style>
For nothing, I answered the question to be more organized.
– Felipe Duarte