[Vuejs]-Pass a property parameter to the Vue component

0๐Ÿ‘

โœ…

You could try wrapping them in <b-tabs v-model="tabIndex"></b-tabs> and then have a computed method that determines the index based off the prop.

EDIT

computed: {
  tabIndex: {
    get: function() {
      if (this.activeTab === 'register') {
        return 1;
      } else {
        return 0;
      }
    },
    set: function(newValue) {
      return newValue;
    }
  }
}

0๐Ÿ‘

Try passing openModal.bind(undefined,'login') so you return a function with the bound params instead of invoking that function.

Also, the tabs component is set with the v-model attribute. It uses numeric indexes to set the active tab.

Maybe make a lookup object to simplify things:
const tab_map = { login: 0, register: 1 }

Then you can setup openModal.bind(undefined, tab_map.login)

For the v-model setup on tabs, check this example out: https://bootstrap-vue.js.org/docs/components/tabs/#external-controls

Leave a comment