Answer the question
In order to leave comments, you need to log in
vue.js. Integrating third-party vue plugins into a project using a TypeScript template?
Good day!
I'm starting to quietly pick TypeScript. Since, best of all, “picking” goes on examples, I started to make a simple SPA-blog. Since I only know Vue.js of all modern JS frameworks, I chose this starter template for it (set, of course, through vue-cli): https://github.com/ducksoupdev/vue-webpack-typescript
So Here is the question: how is the integration of third-party vue plugins and their call in components now going on? For example, the same vue-meta ? I do everything as usual:
Import the plugin in
Initialization and configuration (ibid.)./src/main.ts
import Meta from 'vue-meta';
Vue.use(Meta, {
keyName: 'head',
attribute: 'data-vue-meta',
ssrAttribute: 'data-vue-meta-ssr',
tagIDKeyName: 'vmid'
});
./src/components/home/home.ts
)export class HomeComponent extends Vue {
static head() {
return {
title: 'Test'
}
}
}
Answer the question
In order to leave comments, you need to log in
What do you want to achieve with these settings?
Vue.use is just about installing and configuring the plugin itself into the application.
Head elements are changed in components via metaInfo.
Try replacing static head() with static metaInfo().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question