let's we have a data variable and i want to use this data variable for my style.
data()
{
return{
selected:{
index: 2
}
}
}
<style>
.parent-table >>> .table-row:nth-child(/* here i want to pass selected.index */) {
background: red;
}
</style>
My use case is that i have a table component used in my landing page . I want to change background of selected row of table from my landing page.
this.selected.index. You have various class name.parent-tableand.table-row, I don't realy understand, but you can apply css property with the css selector:nth-child(index)document.querySelector('css_selector').style.backgroundColor('red');v-data-table? Also, do you want to change the row color on click on the row ?