Answer the question
In order to leave comments, you need to log in
How to make styles in .vue file disable/enable by condition?
Good afternoon. There is a task to make styles of components disconnected. For example, we pass is_stylized: false to props, and styles should not be applied. Roughly speaking, to work something like:
<style lang="scss" scoped v-if="is_stylized"></style>
But of course, that doesn't work. How do you make sure that this is exactly what happens? Maybe not through props, but somehow...
Answer the question
In order to leave comments, you need to log in
Well, make a class by condition from props. What the fuck are you suffering
<template>
<div
:class="{
myClass: isStylized
}"
>
<div>
</template>
<script>
export default {
props: {
isStylized: {
type: Boolean,
default: true
}
}
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question