2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-14 21:42:25 +03:00
Files
vue-meta/src/index.js
T
2016-11-01 19:18:58 +02:00

25 lines
544 B
JavaScript

import $meta from './$meta'
import getMetaInfo from './getMetaInfo'
import updateClientMetaInfo from './updateClientMetaInfo'
// automatic install
if (typeof Vue !== 'undefined') {
Vue.use(VueMeta)
}
/**
* Plugin install function.
* @param {Function} Vue - the Vue constructor.
*/
export default function VueMeta (Vue) {
// bind the $meta method to this component instance
Vue.prototype.$meta = $meta
// watch for client side updates
Vue.mixin({
mounted () {
updateClientMetaInfo(getMetaInfo(this.$root))
}
})
}