I have one problem. In server i have technologies, and in my html file i want to render them:
<div
v-for="(technology, index) in technologies"
:key="technology.id"
>
technology-card
v-if="index < currentlyTechnologies"
:technology="technology"
/>
</div>
<button
type="button"
@click="onToggleButtonClick"
>
{{ toggleButtonText }}
</button>
In my Vue.js code i do next:
data () {
return {
currentlyTechnologies: 6
}
},
computed: {
toggleButtonText (): string {
return this.currentlyTechnologies === this.technologies.length ? 'Show less' : 'Show more'
}
},
methods: {
onToggleButtonClick () {
const limitTechnologies = 6
this.currentlyTechnologies = this.currentlyTechnologies === limitTechnologies ? this.technologies.length : limitTechnologies
}
}
But in DOM i have all 18 element. how can I draw only those elements that will be visible on the page? Thank you!