|
@@ -52,9 +52,9 @@ export default {
|
|
editionid: String,
|
|
editionid: String,
|
|
loadedtextsuuids: Array
|
|
loadedtextsuuids: Array
|
|
},
|
|
},
|
|
- // data: () => ({
|
|
|
|
- //
|
|
|
|
- // })
|
|
|
|
|
|
+ data: () => ({
|
|
|
|
+ isOpened: false
|
|
|
|
+ }),
|
|
computed: {
|
|
computed: {
|
|
children () {
|
|
children () {
|
|
// check if children exists and if it is an array
|
|
// check if children exists and if it is an array
|
|
@@ -70,7 +70,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
titlelevel () {
|
|
titlelevel () {
|
|
- return 'h' + this.level
|
|
|
|
|
|
+ return this.level < 7 ? `h${this.level}` : `span`
|
|
},
|
|
},
|
|
nextLevel () {
|
|
nextLevel () {
|
|
return this.level + 1
|
|
return this.level + 1
|
|
@@ -83,21 +83,25 @@ export default {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- isOpened () {
|
|
|
|
- // console.log('opened', this.$route.params.textid.indexOf(this.item.uuid) >= 0)
|
|
|
|
- if (typeof this.$route.params.textid !== 'undefined') {
|
|
|
|
- return this.$route.params.textid.indexOf(this.item.uuid) >= 0
|
|
|
|
- } else {
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
isLoaded () {
|
|
isLoaded () {
|
|
|
|
+ // this is updated when loadedtextsuuids is changing
|
|
|
|
+ // but not for isOpened (had to use a watcher + beforeMount)
|
|
|
|
+ // don't now why ?
|
|
return this.loadedtextsuuids.indexOf(this.item.uuid) !== -1
|
|
return this.loadedtextsuuids.indexOf(this.item.uuid) !== -1
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ watch: {
|
|
|
|
+ loadedtextsuuids (n, o) {
|
|
|
|
+ // console.log('EdTocItem watch loadedtxtsuuids', o, n)
|
|
|
|
+ this.isOpened = this.loadedtextsuuids.some(e => e.indexOf(this.item.uuid) >= 0)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// beforeCreate () {
|
|
// beforeCreate () {
|
|
// console.log('editionid', this.editionid)
|
|
// console.log('editionid', this.editionid)
|
|
// },
|
|
// },
|
|
|
|
+ beforeMount () {
|
|
|
|
+ this.isOpened = this.$route.params.textid.indexOf(this.item.uuid) >= 0
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
onclick (e) {
|
|
onclick (e) {
|
|
console.log('clicked on toc text', this.editionid, e)
|
|
console.log('clicked on toc text', this.editionid, e)
|