I have a component called customer-type
.
I do have the full year and I do have a lot of components as well. So I want to reduce rendering.
How can I load a component after click renderComponent
?
<template v-for="(date, index) in daysOfYear">
<b-tr :key="date" :id="`row-${getDay(date)}`">
<customer-type :id="`customer-${index}`" @test="setCustomer" v-bind:listTypes="listTypes" />
<button @click="renderComponent(index)"> </button>
</b-tr>
</template>
methods: {
renderComponent(index) {
}
}
I don't want to render the component before I explicitly click on it.
@Majed is right. Basically,
v-if
will only render the element in the DOM when the condition is met. Another alternative isv-show
basically it works the same way asv-if
, the difference is thatv-show
will always render the element in the DOM andv-if
won't