export default {
	install(Vue) {
		Object.defineProperties(Vue.prototype, {
			$breadcrumbs: {
				get() {
					return this.$route.matched;
				}
			}
		});

		Vue.component('breadcrumbs', {
			template: `
				<ol class="breadcrumb" v-if="$breadcrumbs.length">
					<li class="breadcrumb-item" v-if="crumb.meta.breadcrumb" v-for="(crumb, i) in $breadcrumbs">
						<router-link active-class="active" :to="{ path: crumb.path }" :tag="i != $breadcrumbs.length - 1 ? 'a' : 'span'">{{ crumb.meta.breadcrumb }}</router-link>
					</li>
				</ol>
				`
		});
	}
};

export default {
	install(Vue) {
		Object.defineProperties(Vue.prototype, {
			$breadcrumbs: {
				get() {
					return this.$route.matched;
				}
			}
		});

		Vue.component('breadcrumbs', {
			methods: {
				getBreadcrumb: function getBreadcrumb(bc) {
					return typeof bc === 'function' ? bc() : bc
				},
			},
			template: `
				<ol class="breadcrumb" v-if="$breadcrumbs.length">
					<li class="breadcrumb-item" v-if="crumb.meta.breadcrumb" v-for="(crumb, i) in $breadcrumbs">
						<router-link active-class="active" :to="{ path: crumb.path }" :tag="i != $breadcrumbs.length - 1 ? 'a' : 'span'">{{ getBreadcrumb(crumb.meta.breadcrumb) }}</router-link>
					</li>
				</ol>
				`
		});
	}
};

Make breadcrumbs dynamic, i.e. now they may be functions.
Make breadcrumbs dynamic, i.e. now they may be functions.

In doing so it's possible to e.g. update the breadcrumbs when changing the language.
