Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
use props to change height of class

I work with Vue 3 and Bootstrap 5. I have a props called number (get me integers from 1 - 10).

Now I want to work with with my number in my scrollbar-class.

I've tried as following but it's not working. I get no error - it's simply not working.

How can I fix that? Thank You!

<template>
  <div class="scrollbar"
  </div>
</template>

<script>
  export default {
    props: {
      number: Number,
    }
  }
</script>
<style>
  .scrollbar {
    height: calc(500px + (var(--number) * 20 px));
  }
</style>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use v-bind in your <style> tag to bind a data property to your CSS.

It will also reactivly update, if your state changes.

<template>
  <div class="scrollbar">
  </div>
</template>

<script>
  export default {
    props: {
      number: Number,
    }
  }
</script>

<style>
  .scrollbar {
    height: calc(500px + (v-bind(number) * 20px));
  }
</style>

Demo

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!