mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 18:10:33 +03:00
Finally solved the types.
This commit is contained in:
@@ -79,6 +79,7 @@
|
|||||||
- [How do I populate `metaInfo` from the result of an asynchronous action?](#how-do-i-populate-metainfo-from-the-result-of-an-asynchronous-action)
|
- [How do I populate `metaInfo` from the result of an asynchronous action?](#how-do-i-populate-metainfo-from-the-result-of-an-asynchronous-action)
|
||||||
- [Why doesn't `vue-meta` support `jsnext:main`?](#why-doesnt-vue-meta-support-jsnextmain)
|
- [Why doesn't `vue-meta` support `jsnext:main`?](#why-doesnt-vue-meta-support-jsnextmain)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
|
- [TypeScript Support](#typescript-support)
|
||||||
|
|
||||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
@@ -794,3 +795,18 @@ If this were not the case, you would have to instruct Babel to convert `default`
|
|||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
To run the examples; clone this repository & run `npm install` in the root directory, and then run `npm run dev`. Head to http://localhost:8080.
|
To run the examples; clone this repository & run `npm install` in the root directory, and then run `npm run dev`. Head to http://localhost:8080.
|
||||||
|
|
||||||
|
# TypeScript Support
|
||||||
|
|
||||||
|
If you have problems with types using vue-meta, then you're most probably using vue-class-component.
|
||||||
|
In any troublesome situation, just add the following ambient declaration to your types:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { MetaInfo } from 'vue-meta';
|
||||||
|
|
||||||
|
declare module "vue/types/vue" {
|
||||||
|
interface Vue {
|
||||||
|
metaInfo?: MetaInfo | (() => MetaInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
+3
-1
@@ -77,7 +77,9 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
"yarn.lock"
|
"yarn.lock",
|
||||||
|
"types/index.d.ts",
|
||||||
|
"types/vue.d.ts"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/declandewet/vue-meta",
|
"homepage": "https://github.com/declandewet/vue-meta",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
Vendored
+1
-12
@@ -33,18 +33,7 @@ export interface MetaInfo {
|
|||||||
charset?: string,
|
charset?: string,
|
||||||
content?: string,
|
content?: string,
|
||||||
'http-equiv'?: 'content-security-policy' | 'refresh',
|
'http-equiv'?: 'content-security-policy' | 'refresh',
|
||||||
name?: 'application-name'
|
name?: string,
|
||||||
| 'author'
|
|
||||||
| 'description'
|
|
||||||
| 'generator'
|
|
||||||
| 'keywords'
|
|
||||||
| 'referrer'
|
|
||||||
| 'creator'
|
|
||||||
| 'googlebot'
|
|
||||||
| 'publisher'
|
|
||||||
| 'robots'
|
|
||||||
| 'slurp'
|
|
||||||
| 'viewport',
|
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}[]
|
}[]
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"module": "es2015",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"lib": [
|
||||||
|
"es5",
|
||||||
|
"dom",
|
||||||
|
"es2015.promise"
|
||||||
|
],
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+2
-2
@@ -7,12 +7,12 @@ import { MetaInfo } from './index';
|
|||||||
|
|
||||||
declare module "vue/types/options" {
|
declare module "vue/types/options" {
|
||||||
interface ComponentOptions<V extends Vue> {
|
interface ComponentOptions<V extends Vue> {
|
||||||
metaInfo?: MetaInfo | (() => MetaInfo);
|
metaInfo?: MetaInfo | (() => MetaInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "vue/types/vue" {
|
declare module "vue/types/vue" {
|
||||||
interface Vue {
|
interface Vue {
|
||||||
metaInfo?: MetaInfo | (() => MetaInfo);
|
metaInfo?: MetaInfo | (() => MetaInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user