yuche / vue-strap

Bootstrap components built with Vue.js
http://yuche.github.io/vue-strap/
MIT License
4.71k stars 935 forks source link

Emit "collapse" event on Navbar click or blur (issue #487) #494

Open neilsmind opened 7 years ago

neilsmind commented 7 years ago

We needed this for a current project so went ahead and built it. Hope it can help the project.

<template>
  <navbar placement="top" v-on:collapse="collapse"> <!-- <------- Here's the custom event
  ...
  </navbar>
</template>

<script>
import { navbar, dropdown } from 'vue-strap';

export default {
  data: function data() {
    return {
      collapsed: true,
    };
  },
  components: {
    navbar,
    dropdown,
  },
  methods: {
    collapse() { // <-- This is the function called on the event
      this.collapsed = true;
    },
  },
};
</script>

What does it do?

What else should I know?

Related Issues

cc: @wffranco @yuche @shaoxiong789