mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-12 17:02:24 +03:00
feat: export hasMetaInfo helper function
This commit is contained in:
+8
-6
@@ -3,13 +3,13 @@ import createMixin from './shared/mixin'
|
||||
import setOptions from './shared/options'
|
||||
import { isUndefined } from './shared/typeof'
|
||||
import $meta from './client/$meta'
|
||||
export { hasMetaInfo } from './shared/hasMetaInfo'
|
||||
import { hasMetaInfo } from './shared/hasMetaInfo'
|
||||
|
||||
/**
|
||||
* Plugin install function.
|
||||
* @param {Function} Vue - the Vue constructor.
|
||||
*/
|
||||
function VueMeta(Vue, options = {}) {
|
||||
function install(Vue, options = {}) {
|
||||
options = setOptions(options)
|
||||
|
||||
Vue.prototype.$meta = $meta(options)
|
||||
@@ -17,12 +17,14 @@ function VueMeta(Vue, options = {}) {
|
||||
Vue.mixin(createMixin(Vue, options))
|
||||
}
|
||||
|
||||
VueMeta.version = version
|
||||
|
||||
// automatic install
|
||||
if (!isUndefined(window) && !isUndefined(window.Vue)) {
|
||||
/* istanbul ignore next */
|
||||
Vue.use(VueMeta)
|
||||
install(window.Vue)
|
||||
}
|
||||
|
||||
export default VueMeta
|
||||
export default {
|
||||
version,
|
||||
install,
|
||||
hasMetaInfo
|
||||
}
|
||||
|
||||
+7
-5
@@ -2,13 +2,13 @@ import { version } from '../package.json'
|
||||
import createMixin from './shared/mixin'
|
||||
import setOptions from './shared/options'
|
||||
import $meta from './server/$meta'
|
||||
export { hasMetaInfo } from './shared/hasMetaInfo'
|
||||
import { hasMetaInfo } from './shared/hasMetaInfo'
|
||||
|
||||
/**
|
||||
* Plugin install function.
|
||||
* @param {Function} Vue - the Vue constructor.
|
||||
*/
|
||||
function VueMeta(Vue, options = {}) {
|
||||
function install(Vue, options = {}) {
|
||||
options = setOptions(options)
|
||||
|
||||
Vue.prototype.$meta = $meta(options)
|
||||
@@ -16,6 +16,8 @@ function VueMeta(Vue, options = {}) {
|
||||
Vue.mixin(createMixin(Vue, options))
|
||||
}
|
||||
|
||||
VueMeta.version = version
|
||||
|
||||
export default VueMeta
|
||||
export default {
|
||||
version,
|
||||
install,
|
||||
hasMetaInfo
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user