new Vue({ el: "#authors_app", template: `

Meet your Guides

`, data() { return { search: '', authors: [], authorsToShow: 50, totalAuthors: 0 }; }, methods: { descriptionTransform: function(description) { if (description) { return description.replace(/<[^>]*>?/gm, '').split('##')[1] ? description.replace(/<[^>]*>?/gm, '').split('##')[1] : '' } else { return '' } }, arrayMove: function (array, from, to) { if( to === from ) return array; var target = array[from]; var increment = to < from ? -1 : 1; for(var k = from; k != to; k += increment){ array[k] = array[k + increment]; } array[to] = target; return array; } }, computed: { filteredList() { let items = this.authors; items.sort((a, b) => a.title.localeCompare(b.title)) let first = {}; function move(array, from, to) { if( to === from ) return array; var target = array[from]; var increment = to < from ? -1 : 1; for(var k = from; k != to; k += increment){ array[k] = array[k + increment]; } array[to] = target; return array; } move(items, 1, 0) return items // return this.authors.filter(author => { // let string = author.title.toLowerCase() + this.descriptionTransform(author.description) // return string.includes(this.search.toLowerCase()) // }) } }, created() { this.totalAuthors = this.authors.length axios .get('/api/authors/') .then(response => this.authors = response.data) } })