[+] Update title

This commit is contained in:
Hykilpikonna
2021-12-26 21:48:23 -05:00
parent e13aea1d31
commit 1327ec85cb
+11 -1
View File
@@ -72,6 +72,8 @@ export default class BlogPostPreview extends Vue
mounted(): void
{
this.updateTitle()
// Create accordion
$(`.${this.uid}`).accordion({collapsible: true, header: '#titles', heightStyle: 'content',
active: this.active ? 0 : false})
@@ -79,13 +81,16 @@ export default class BlogPostPreview extends Vue
/**
* Watch active status change, use this to change accordions' activation on history back/forward
*
* Also use this to change the title
*/
@Watch('active')
onActiveChange(): void
{
console.log('Blog Post: onActiveChange Called on', this.meta.title)
this.updateTitle()
// Ignore active status changes due to clicking the title
console.log('Blog Post: onActiveChange Called on', this.meta.title)
if (this.isActiveChangeDueToClickTitle)
{
this.isActiveChangeDueToClickTitle = false
@@ -96,6 +101,11 @@ export default class BlogPostPreview extends Vue
$(`.${this.uid}`).accordion('option', {active: this.active ? 0 : false});
}
updateTitle(): void
{
if (this.active) document.title = `Blog: ${this.meta.title}`
}
isActive(): boolean
{
return $(`.${this.uid} > .ui-state-active`).length != 0