settings tabs now remember their previous state

This commit is contained in:
booploops 2022-04-29 18:14:44 -07:00
parent 988282845f
commit 4dc96056a2

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="cider-settings"> <script type="text/x-template" id="cider-settings">
<div class="content-inner settings-page"> <div class="content-inner settings-page">
<b-tabs pills fill content-class="mt-3"> <b-tabs pills fill content-class="mt-3" v-model="tabIndex">
<b-tab :title="$root.getLz('settings.header.general')" active> <b-tab :title="$root.getLz('settings.header.general')" active>
<div class="md-option-container"> <div class="md-option-container">
<!-- General Settings --> <!-- General Settings -->
@ -1522,10 +1522,28 @@
data: function () { data: function () {
return { return {
app: this.$root, app: this.$root,
themes: ipcRenderer.sendSync("get-themes") themes: ipcRenderer.sendSync("get-themes"),
tabIndex: 0,
canChangeHash: false
}
}, watch: {
tabIndex: function (val) {
if (this.canChangeHash) {
window.location.hash = `#settings/${val}`
}
} }
}, },
mounted: function () { mounted: function () {
this.$nextTick(function () {
if (window.location.hash.split("/").length > 1) {
this.tabIndex = parseInt(window.location.hash.split("/")[1])
console.debug("tabIndex", this.tabIndex)
this.canChangeHash = true
}else{
this.canChangeHash = true
}
})
if (app.cfg.lastfm.enabled) { if (app.cfg.lastfm.enabled) {
const element = document.getElementById('lfmConnect'); const element = document.getElementById('lfmConnect');
if (element) { if (element) {