Can I add some variables in app.html like {{ APP }} based on req?

SevenGuns
10
SevenGuns
commented 2 months ago
0
SevenGuns
10
SevenGuns
commented 2 months ago

Thx, I have solved the problem.
head() {
if (!process.server) {
return;
}
const v = this.$ssrContext.req.ctx.query.v;
if (v === 'console') {
return {
script: [
{ src: 'https://xxxx.com/common/js/vconsole.min.js' },
{ innerHTML: 'var vConsole = new VConsole();' }
]
};
}
},

0
Alecell
5
Alecell
commented 2 months ago

This helps me when I try to add og tags on the head based on the request url.
https://medium.com/vue-mastery/best-practices-for-nuxt-js-seo-32399c49b2e5

1
SevenGuns
10
SevenGuns
commented 2 months ago

Thx, I have solved the problem.
head() {
if (!process.server) {
return;
}
const v = this.$ssrContext.req.ctx.query.v;
if (v === 'console') {
return {
script: [
{ src: 'https://xxxx.com/common/js/vconsole.min.js' },
{ innerHTML: 'var vConsole = new VConsole();' }
]
};
}
},

0
Informations
Question โ€ข Resolved
#c9804 - Created 2 months ago