Demo previews: Memorize active tab
This commit is contained in:
@@ -120,6 +120,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
currentTab(newCurrentTab) {
|
||||||
|
localStorage.tab = newCurrentTab
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
showTabs() {
|
showTabs() {
|
||||||
return this.sortedTabs.length > 1
|
return this.sortedTabs.length > 1
|
||||||
@@ -226,7 +232,8 @@ export default {
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// TODO: load language from url params
|
// TODO: load language from url params
|
||||||
this.setTab(this.sortedTabs[0]?.name)
|
const intitialTab = localStorage.tab ? localStorage.tab : this.sortedTabs[0]?.name
|
||||||
|
this.setTab(intitialTab)
|
||||||
|
|
||||||
window.document.addEventListener('editor', this.onEditor, false)
|
window.document.addEventListener('editor', this.onEditor, false)
|
||||||
window.document.addEventListener('source', this.onSource, false)
|
window.document.addEventListener('source', this.onSource, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user