1๐
If showBranding is a CSS class, you have to add single quote around your css className, like this:
<div :class={'showBranding': brandingIsEnabled}>
// content
</div>
Then your class has to be inside a style tag into your component like this:
<style scoped>
.showBranding {
// content
}
</style>
Check also if your brandingIsEnabled data is inside your script tag like this:
<script>
export default {
data() {
return {
brandingIsEnabled: true
}
}
}
</script>
This example uses the single component syntax.
๐ค96eleven
- [Vuejs]-Vue.js โ Use props in single file component script section
- [Vuejs]-Is it possible to include Vue Admin (Bulma) into Laravel?
-2๐
new Vue({
el: '#br',
data: {
showBranding: 'brandingClass',
brandingEnabled:true
}
});
CSS Code
.brandingClass{
display:none
}
html code
<div id="br">
<div :class="{ showBranding:brandingEnabled }">BRANDING</div>
</div>
๐คOmid Matouri
Source:stackexchange.com