Plugin methods
The vue-meta
plugin injects a $meta()
function in the Vue prototype which provides the following methods
Note
$meta()
is a function so we only need to insert it once in the Vue.prototype
, but still use this
to reference the component it was called from
$meta().getOptions
- returns
pluginOptions
Could be used by third-party libraries who wish to interact withvue-meta
$meta().refresh
- returns
metaInfo
Updates the current metadata with new metadata.Useful when updating metadata as the result of an asynchronous action that resolves after the initial render takes place.
$meta().inject
- returns
metaInfo
SSR only
inject
is available in the server plugin only and is not available on the client
It returns a special metaInfo
object where all keys have an object as value which contains a text()
method for returning html code
See Rendering with renderToString for an example
Passing arguments to text()
In some cases you can pass an argument to the text method. E.g. to automatically add the ssrAttribute on ssr or render properties in the body
$meta().pause
- arguments:
- refresh (type
boolean
, defaultfalse
)
- refresh (type
- returns
resume()
Pauses global metadata updates until either the returned resume method is called or resume
$meta().resume
当前内容版权归 nuxtjs.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nuxtjs.org .