Vue JS integration
richardk80 opened this issue · comments
Does this only work with Blade files or can this also be used in some way with Vue JS? Like with Jetstream for example.
@richardk80 Yes this only works with Blade templates, for Frontend stuff it's kinda out of scope.
But here is my recommendation since I'm using Vue also. Basically you can create a simple class/function to achive it:
// you can import more translations or stuffs...
class PageTitle {
this.postfix = "SethPhat's Github";
set(pageTitle) {
document.title = pageTitle + " - " + this.postfix
}
}
const pageTitle = new PageTitle();
export {pageTitle};
And in your Vue component, after requested for data:
import {pageTitle} from "...";
methods: {
async getArticle() {
const article = await axios.get(....);
pageTitle.set(article.title);
}
},
created() {
this.getArticle();
}
Thanks
Thanks. I'll save this in a gist for further use.