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

125
Views
Bootstrap Dropdown Button not displaying V-For Elements

I have the following Vue.js (3) component, which uses Bootstrap (5):

<template>
  <div class="dropdown">
    <button class="btn btn-secondary dropdown-toggle btn-link text-decoration-none text-dark" type="button" id="languageDropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      {{ languages[$i18n.locale] }}
    </button>
    <div class="dropdown-menu" aria-labelledby="languageDropdown" v-for="(value, key) in languages" v-bind:key="key">
      <a class="dropdown-item" href="#" @click="changeLanguage(key)">{{ value }}</a>
    </div>

    <li v-for="(value, key) in languages" v-bind:key="key">
      {{ key }}: {{ value }}
    </li>
  </div>
</template>

<script>
export default {
  name: "LanguageSwitcher",
  data() {
    return { 
      languages: {
        'en': 'English',
        'de': 'Deutsch',
      }
    };
  },
  methods: {
    changeLanguage: function(lang){
      this.$i18n.locale = lang;
    }
  }
};
</script>

Without the v-for everything works fine. But as soon, as I add it, only the first element of the object languages gets rendered.

As you can see, the list is rendered correctly, with both languages.

enter image description here

Only in the dropdown, "Deutsch" (German) is not rendered.

enter image description here

Is this a bug with Bootstrap/Vue or am I missing something?

about 4 years ago · Juan Pablo Isaza
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!