Start your All-Access Pass to unlock this challenge
Challenge 1 / 2
Imagine I have a simple component that can show a message when one of our customers has bought too much pizza.
<template>
<div :class="{
[$style.component]: true,
[$style.tall]: showDisclaimer,
}"
>
<button @click="addPizzaToCart" />
<p v-show="showDisclaimer">
<strong>Disclaimer</strong>: Eating too much pizza can be
bad for your health!
</p>
</div>
</template>
<script>
import { buyPizza } from '@/services/buy-pizza';
export default {
name: 'PizzaCheckout',
data() {
return {
pizzaCount: 0,
showDisclaimer: false,
};
},
methods: {
async addPizzaToCart() {
await buyPizza();
this.pizzaCount++;
if (this.pizzaCount > 10) {
this.showDisclaimer = true;
}
}
},
};
</script>
In an application where this component has a fixed height, I want to add some styling so that its height will transition smoothly when that message toggles on and off.
Which style
tag would be good for the job?
Skip challenges and go to theNext Chapter