mirror of
https://github.com/getbible/app.git
synced 2024-12-22 07:48:55 +00:00
added chapter searching
This commit is contained in:
parent
c19903fa23
commit
0070e461d5
@ -1,5 +1,6 @@
|
|||||||
<template >
|
<template >
|
||||||
<div v-if="verses.length">
|
<div v-if="verses.length">
|
||||||
|
{{search.toLowerCase() + fverses.length}}
|
||||||
<ul :dir="dir"
|
<ul :dir="dir"
|
||||||
class="uk-margin-medium-top uk-list uk-list-divider uk-animation-hover">
|
class="uk-margin-medium-top uk-list uk-list-divider uk-animation-hover">
|
||||||
<li v-for="(verse, i) in pverses" :key="i"
|
<li v-for="(verse, i) in pverses" :key="i"
|
||||||
@ -43,6 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import _ from 'lodash';
|
||||||
import {mapGetters} from 'vuex';
|
import {mapGetters} from 'vuex';
|
||||||
export default {
|
export default {
|
||||||
data: () => {
|
data: () => {
|
||||||
@ -53,14 +55,27 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['verses', 'dir', 'book_name']),
|
...mapGetters(['verses', 'dir', 'book_name', 'search']),
|
||||||
pverses(){
|
pverses(){
|
||||||
return this.verses.slice(this.prev, this.next)
|
return this.fverses.slice(this.prev, this.next)
|
||||||
}
|
},
|
||||||
|
fverses: function (){
|
||||||
|
console.log(this.search);
|
||||||
|
if(!this.search)
|
||||||
|
return this.verses
|
||||||
|
return this.filteredVerses
|
||||||
|
},
|
||||||
|
filteredVerses() {
|
||||||
|
return _.orderBy(this.verses.filter((item) =>
|
||||||
|
item.verse.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||||
|
|| item.chapter.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||||
|
|| item.name.toString().toLowerCase().includes(this.search.toLowerCase())
|
||||||
|
|| item.text.toLowerCase().includes(this.search.toLowerCase())), 'verse');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
nextV(){
|
nextV(){
|
||||||
if(this.next> this.verses.length) return;
|
if(this.next> this.fverses.length) return;
|
||||||
this.next = this.next + 5
|
this.next = this.next + 5
|
||||||
this.prev = this.prev+ 5
|
this.prev = this.prev+ 5
|
||||||
// console.log(this.next, this.prev);
|
// console.log(this.next, this.prev);
|
||||||
|
Loading…
Reference in New Issue
Block a user