Improved actor scraping and display.

This commit is contained in:
2020-05-18 01:22:56 +02:00
parent af5543190a
commit 8733fdc657
28 changed files with 1033 additions and 793 deletions

View File

@@ -1,57 +1,64 @@
<template>
<form
class="search"
@submit.prevent="search"
>
<input
ref="search"
v-model="query"
type="search"
class="search-input"
placeholder="Search..."
>
<button
type="submit"
class="search-button"
><Icon
icon="search"
/></button>
</form>
<form
class="search"
@submit.prevent="search"
>
<input
ref="search"
v-model="query"
type="search"
class="search-input"
placeholder="Search..."
>
<button
type="submit"
class="search-button"
><Icon
icon="search"
/></button>
</form>
</template>
<script>
async function search() {
this.$router.push({ name: 'search', query: { q: this.query } });
this.$emit('search');
this.$router.push({ name: 'search', query: { q: this.query } });
this.$emit('search');
}
function searching(to) {
if (to) {
setTimeout(() => {
// nextTick does not seem to work
this.$refs.search.focus();
}, 20);
}
if (to) {
setTimeout(() => {
// nextTick does not seem to work
this.$refs.search.focus();
}, 20);
}
}
function route(to) {
if (to.name !== 'search') {
this.query = null;
}
}
export default {
props: {
searching: {
type: Boolean,
default: false,
},
},
data() {
return {
query: this.$route.query ? this.$route.query.q : null,
};
},
watch: {
searching,
},
methods: {
search,
},
props: {
searching: {
type: Boolean,
default: false,
},
},
data() {
return {
query: this.$route.query ? this.$route.query.q : null,
};
},
watch: {
$route: route,
searching,
},
methods: {
search,
},
};
</script>