mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-25 02:10:33 +03:00
logically group modules into folders
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import updateTitle from './updateTitle'
|
import updateTitle from './updaters/updateTitle'
|
||||||
import updateTagAttributes from './updateTagAttributes'
|
import updateTagAttributes from './updaters/updateTagAttributes'
|
||||||
import { SERVER_RENDERED_ATTRIBUTE } from './constants'
|
import { SERVER_RENDERED_ATTRIBUTE } from '../shared/constants'
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window !== null) {
|
if (typeof window !== 'undefined' && window !== null) {
|
||||||
var htmlTag = document.getElementsByTagName('html')[0]
|
var htmlTag = document.getElementsByTagName('html')[0]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { VUE_META_ATTRIBUTE } from './constants'
|
import { VUE_META_ATTRIBUTE } from '../../shared/constants'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updates the document's html tag attributes
|
* updates the document's html tag attributes
|
||||||
+2
-34
@@ -1,35 +1,3 @@
|
|||||||
import $meta from './$meta'
|
import install from './shared/plugin'
|
||||||
import getMetaInfo from './getMetaInfo'
|
|
||||||
import updateClientMetaInfo from './updateClientMetaInfo'
|
|
||||||
|
|
||||||
// automatic install
|
export default 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
|
|
||||||
|
|
||||||
// store an id to keep track of DOM updates
|
|
||||||
let requestId = null
|
|
||||||
|
|
||||||
// watch for client side component updates
|
|
||||||
Vue.mixin({
|
|
||||||
beforeMount () {
|
|
||||||
// batch potential DOM updates to prevent extraneous re-rendering
|
|
||||||
window.cancelAnimationFrame(requestId)
|
|
||||||
|
|
||||||
requestId = window.requestAnimationFrame(() => {
|
|
||||||
requestId = null
|
|
||||||
|
|
||||||
// update the meta info
|
|
||||||
updateClientMetaInfo(getMetaInfo(this.$root), this.$root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import titleGenerator from './titleGenerator'
|
import titleGenerator from './generators/titleGenerator'
|
||||||
import attrsGenerator from './attrsGenerator'
|
import attrsGenerator from './generators/attrsGenerator'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a meta info property to one that can be stringified on the server
|
* Converts a meta info property to one that can be stringified on the server
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { VUE_META_ATTRIBUTE } from './constants'
|
import { VUE_META_ATTRIBUTE } from '../../shared/constants'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates tag attributes for use on the server.
|
* Generates tag attributes for use on the server.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { VUE_META_ATTRIBUTE } from './constants'
|
import { VUE_META_ATTRIBUTE } from '../../shared/constants'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates title output for the server
|
* Generates title output for the server
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import getMetaInfo from './getMetaInfo'
|
import getMetaInfo from '../shared/getMetaInfo'
|
||||||
import generateServerInjector from './generateServerInjector'
|
import generateServerInjector from './generateServerInjector'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import getMetaInfo from './getMetaInfo'
|
||||||
|
import $meta from '../server/$meta'
|
||||||
|
import updateClientMetaInfo from '../client/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
|
||||||
|
|
||||||
|
// store an id to keep track of DOM updates
|
||||||
|
let requestId = null
|
||||||
|
|
||||||
|
// watch for client side component updates
|
||||||
|
Vue.mixin({
|
||||||
|
beforeMount () {
|
||||||
|
// batch potential DOM updates to prevent extraneous re-rendering
|
||||||
|
window.cancelAnimationFrame(requestId)
|
||||||
|
|
||||||
|
requestId = window.requestAnimationFrame(() => {
|
||||||
|
requestId = null
|
||||||
|
|
||||||
|
// update the meta info
|
||||||
|
updateClientMetaInfo(getMetaInfo(this.$root), this.$root)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user