2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-18 20:30:34 +03:00

chore: add docs site

This commit is contained in:
pimlie
2019-03-10 21:58:13 +01:00
parent 3db250dfea
commit 5aa94ceea3
17 changed files with 6173 additions and 92 deletions
+39
View File
@@ -0,0 +1,39 @@
# Caveats
## Reactive variables in template functions
Both [title](/api/#titletemplate) as [meta](/api/#content-templates) support using template function.
Due to how Vue.js determines reactivity it is not possible to use reactive variables directly in template function
```js
{
// this wont work
metaInfo() {
return {
titleTemplate: chunk => (
this.locale === 'nl-NL'
? `${chunk} - Welkom`
: `${chunk} - Welcome`
)
}
}
}
```
You need to assign the reactive variable to a local variable for this to work:
```js
{
// this will work
metaInfo() {
const locale = this.locale
return {
titleTemplate: chunk => (
locale === 'nl-NL'
? `${chunk} - Welkom`
: `${chunk} - Welcome`
)
}
}
}
```