2019-04-03 17:29:03 +02:00
|
|
|
<template>
|
2019-10-10 13:29:58 +02:00
|
|
|
<b-input custom-class="searchField" icon="magnify" type="search" rounded :placeholder="defaultPlaceHolder" v-model="searchText" @keyup.native.enter="enter" />
|
2019-04-03 17:29:03 +02:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
import { RouteName } from '@/router';
|
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class SearchField extends Vue {
|
|
|
|
@Prop({ type: String, required: false }) placeholder!: string;
|
|
|
|
searchText: string = '';
|
|
|
|
|
|
|
|
enter() {
|
|
|
|
this.$router.push({ name: RouteName.SEARCH, params: { searchTerm: this.searchText } });
|
|
|
|
}
|
|
|
|
|
|
|
|
get defaultPlaceHolder(): string {
|
|
|
|
// We can't use "this" inside @Prop's default value.
|
2019-09-12 11:34:01 +02:00
|
|
|
return this.placeholder || this.$t('Search') as string;
|
2019-04-03 17:29:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2019-10-10 13:29:58 +02:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
input.searchField {
|
|
|
|
box-shadow: none;
|
|
|
|
border-color: #b5b5b5;
|
|
|
|
}
|
|
|
|
</style>
|