I have some text that i am trying to change the styling on based on route name.I have set up 2 route names, ads and webs and have set up a watcher to watch the routes. If the route name is either ads or webs i want the text to have color:white;background-color:orange. But i am not sure how to do it.
new Vue({
el: '#app',
data() {
return {
styleClass: null
}
},
watch: {
'$route' (to, from) {
if (to.name == 'ads' || to.name == 'webs') {
}
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/babel-polyfill/dist/polyfill.min.js"></script>
<div id="app">
<span><h1>Hello!!!</h1></span>
</div>