mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-23 09:10:34 +03:00
types: update types for v2.3
This commit is contained in:
+3
-3
@@ -727,7 +727,7 @@ Calling [`inject`](#meta-inject) will return an object on which you can call the
|
|||||||
|
|
||||||
### head <Badge text="v2.3+"/>
|
### head <Badge text="v2.3+"/>
|
||||||
- arguments
|
- arguments
|
||||||
- ln (type `boolean`, default: `true`)
|
- ln (type `boolean`, default: `false`)
|
||||||
|
|
||||||
This is a convenience method which will retrieve the template string which should be added to the `head`.
|
This is a convenience method which will retrieve the template string which should be added to the `head`.
|
||||||
|
|
||||||
@@ -737,7 +737,7 @@ By passing `ln = true` a line break will be added after each element. This could
|
|||||||
|
|
||||||
### bodyPrepend <Badge text="v2.3+"/>
|
### bodyPrepend <Badge text="v2.3+"/>
|
||||||
- arguments
|
- arguments
|
||||||
- ln (type `boolean`, default: `true`)
|
- ln (type `boolean`, default: `false`)
|
||||||
|
|
||||||
This is a convenience method which will retrieve the template string which should be prepended to the body, i.e. listed just after `<body>`.
|
This is a convenience method which will retrieve the template string which should be prepended to the body, i.e. listed just after `<body>`.
|
||||||
|
|
||||||
@@ -745,7 +745,7 @@ Elements will be printed in the same order as the menu below.
|
|||||||
|
|
||||||
### bodyAppend <Badge text="v2.3+"/>
|
### bodyAppend <Badge text="v2.3+"/>
|
||||||
- arguments
|
- arguments
|
||||||
- ln (type `boolean`, default: `true`)
|
- ln (type `boolean`, default: `false`)
|
||||||
|
|
||||||
This is a convenience method which will retrieve the template string which should be appended to the body, i.e. listed just before `</body>`.
|
This is a convenience method which will retrieve the template string which should be appended to the body, i.e. listed just before `</body>`.
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -6,6 +6,7 @@ export default VueMeta
|
|||||||
export {
|
export {
|
||||||
VueMetaOptions,
|
VueMetaOptions,
|
||||||
VueMetaPlugin,
|
VueMetaPlugin,
|
||||||
|
VueMetaApp,
|
||||||
MetaInfo,
|
MetaInfo,
|
||||||
MetaInfoSSR,
|
MetaInfoSSR,
|
||||||
AttributeProperty,
|
AttributeProperty,
|
||||||
|
|||||||
+18
-1
@@ -1,5 +1,12 @@
|
|||||||
import Vue, { ComponentOptions } from 'vue'
|
import Vue, { ComponentOptions } from 'vue'
|
||||||
import VueMeta, { VueMetaPlugin, VueMetaOptions, MetaInfo, MetaInfoSSR } from '../index'
|
import VueMeta, {
|
||||||
|
VueMetaPlugin,
|
||||||
|
VueMetaOptions,
|
||||||
|
VueMetaApp,
|
||||||
|
MetaInfo,
|
||||||
|
MetaInfoSSR,
|
||||||
|
MetaPropertyCharset
|
||||||
|
} from '../index'
|
||||||
|
|
||||||
Vue.use(VueMeta, {
|
Vue.use(VueMeta, {
|
||||||
keyName: 'head'
|
keyName: 'head'
|
||||||
@@ -67,6 +74,16 @@ if (metaDataSSR.script) {
|
|||||||
metaDataSSR.script.text({ body: true })
|
metaDataSSR.script.text({ body: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add app
|
||||||
|
const customApp: VueMetaApp = $meta.addApp('custom-app')
|
||||||
|
|
||||||
|
const metaCharset: MetaPropertyCharset = { charset: 'utf-8' }
|
||||||
|
const customAppInfo: MetaInfo = {
|
||||||
|
meta: [metaCharset]
|
||||||
|
}
|
||||||
|
|
||||||
|
customApp.set(customAppInfo)
|
||||||
|
|
||||||
// pausing & resuming
|
// pausing & resuming
|
||||||
let resume
|
let resume
|
||||||
resume = $meta.pause()
|
resume = $meta.pause()
|
||||||
|
|||||||
Vendored
+32
-11
@@ -5,13 +5,18 @@ type Component = ComponentOptions<Vue> | typeof Vue
|
|||||||
type CallbackFn = () => void
|
type CallbackFn = () => void
|
||||||
type elements = HTMLElement[]
|
type elements = HTMLElement[]
|
||||||
|
|
||||||
export interface VueMetaOptions {
|
export interface VueMetaOptionsRuntime {
|
||||||
|
refreshOnceOnNavigation?: boolean
|
||||||
|
debounceWait?: number
|
||||||
|
waitOnDestroyed?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VueMetaOptions extends VueMetaOptionsRuntime {
|
||||||
keyName: string, // the component option name that vue-meta looks for meta info on.
|
keyName: string, // the component option name that vue-meta looks for meta info on.
|
||||||
attribute: string, // the attribute name vue-meta adds to the tags it observes
|
attribute: string, // the attribute name vue-meta adds to the tags it observes
|
||||||
ssrAppId: string, // the app id used for ssr app
|
ssrAppId: string, // the app id used for ssr app
|
||||||
ssrAttribute: string, // the attribute name that lets vue-meta know that meta info has already been server-rendered
|
ssrAttribute: string, // the attribute name that lets vue-meta know that meta info has already been server-rendered
|
||||||
tagIDKeyName: string // the property name that vue-meta uses to determine whether to overwrite or append a tag
|
tagIDKeyName: string // the property name that vue-meta uses to determine whether to overwrite or append a tag
|
||||||
refreshOnceOnNavigation: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare class VueMeta {
|
export declare class VueMeta {
|
||||||
@@ -21,17 +26,26 @@ export declare class VueMeta {
|
|||||||
static generate(metaInfo: MetaInfo, options?: Object): MetaInfoSSR
|
static generate(metaInfo: MetaInfo, options?: Object): MetaInfoSSR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface RefreshedTags {
|
||||||
|
addedTags: elements
|
||||||
|
removedTags: elements
|
||||||
|
}
|
||||||
|
|
||||||
interface Refreshed {
|
interface Refreshed {
|
||||||
vm: Component,
|
vm: Component,
|
||||||
metaInfo: MetaInfo,
|
metaInfo: MetaInfo,
|
||||||
tags: {
|
tags: RefreshedTags
|
||||||
addedTags: elements
|
}
|
||||||
removedTags: elements
|
|
||||||
}
|
interface VueMetaApp {
|
||||||
|
set(metaInfo: MetaInfo): void | RefreshedTags
|
||||||
|
remove(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VueMetaPlugin {
|
export interface VueMetaPlugin {
|
||||||
getOptions(): VueMetaOptions
|
getOptions(): VueMetaOptions
|
||||||
|
setOptions(runtimeOptions: VueMetaOptionsRuntime): VueMetaOptions
|
||||||
|
addApp(appName: string): VueMetaApp
|
||||||
refresh(): Refreshed
|
refresh(): Refreshed
|
||||||
inject(): MetaInfoSSR
|
inject(): MetaInfoSSR
|
||||||
pause(refresh: true): () => Refreshed
|
pause(refresh: true): () => Refreshed
|
||||||
@@ -188,6 +202,10 @@ interface ToTextBooleanArg {
|
|||||||
text(addSrrAttribute?: boolean): string
|
text(addSrrAttribute?: boolean): string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface AddLineBreakOption {
|
||||||
|
ln: boolean
|
||||||
|
}
|
||||||
|
|
||||||
interface ToBodyTextOption {
|
interface ToBodyTextOption {
|
||||||
body: boolean
|
body: boolean
|
||||||
}
|
}
|
||||||
@@ -197,18 +215,21 @@ interface ToPbodyTextOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ToBodyText {
|
interface ToBodyText {
|
||||||
text(options?: (ToBodyTextOption | ToPbodyTextOption)): string
|
text(options?: (ToBodyTextOption | ToPbodyTextOption | AddLineBreakOption)): string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MetaInfoSSR {
|
export interface MetaInfoSSR {
|
||||||
|
head(ln?: boolean): string
|
||||||
|
bodyPrepend(ln?: boolean): string
|
||||||
|
bodyAppend(ln?: boolean): string
|
||||||
title?: ToText
|
title?: ToText
|
||||||
htmlAttrs?: ToTextBooleanArg
|
htmlAttrs?: ToTextBooleanArg
|
||||||
headAttrs?: ToText
|
headAttrs?: ToText
|
||||||
bodyAttrs?: ToText
|
bodyAttrs?: ToText
|
||||||
base?: ToText
|
base?: ToBodyText
|
||||||
meta?: ToText
|
meta?: ToBodyText
|
||||||
link?: ToText
|
link?: ToBodyText
|
||||||
style?: ToText
|
style?: ToBodyText
|
||||||
script?: ToBodyText
|
script?: ToBodyText
|
||||||
noscript?: ToBodyText
|
noscript?: ToBodyText
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user