2015-12-13 04:42:28 +00:00
|
|
|
<template>
|
|
|
|
<div class="side search" id="searchForm" :class="{ showing: showing }">
|
|
|
|
<input type="search"
|
2016-03-13 17:00:32 +00:00
|
|
|
:class="{ dirty: q }"
|
|
|
|
placeholder="Search"
|
|
|
|
v-model="q"
|
2015-12-22 06:54:49 +00:00
|
|
|
debounce="500"
|
2015-12-13 04:42:28 +00:00
|
|
|
v-koel-focus="showing">
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import isMobile from 'ismobilejs';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
q: '',
|
|
|
|
showing: !isMobile.phone,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
/**
|
|
|
|
* Broadcast a 'filter:changed' event when the filtering query changes.
|
|
|
|
* Other components listening to this filter will update its content.
|
|
|
|
*/
|
|
|
|
q() {
|
|
|
|
this.$root.$broadcast('filter:changed', this.q);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
events: {
|
|
|
|
/**
|
|
|
|
* Listen to 'search:toggle' event to show or hide the search form.
|
|
|
|
* This should only be triggered on a mobile device.
|
|
|
|
*/
|
|
|
|
'search:toggle': function () {
|
|
|
|
this.showing = !this.showing;
|
|
|
|
},
|
2015-12-30 04:14:47 +00:00
|
|
|
|
|
|
|
'koel:teardown': function () {
|
|
|
|
this.q = '';
|
|
|
|
},
|
2015-12-13 04:42:28 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="sass">
|
2016-03-13 17:00:32 +00:00
|
|
|
@import "../../../sass/partials/_vars.scss";
|
|
|
|
@import "../../../sass/partials/_mixins.scss";
|
2015-12-13 04:42:28 +00:00
|
|
|
|
|
|
|
#searchForm {
|
|
|
|
@include vertical-center();
|
|
|
|
flex: 0 0 256px;
|
|
|
|
order: -1;
|
|
|
|
background: $colorSearchFormBgr;
|
|
|
|
|
|
|
|
input[type="search"] {
|
|
|
|
width: 218px;
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
2016-03-13 17:00:32 +00:00
|
|
|
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2016-03-17 09:46:24 +00:00
|
|
|
@media only screen and (max-width : 667px) {
|
2015-12-13 04:42:28 +00:00
|
|
|
z-index: -1;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
background: rgba(0, 0, 0, .8);
|
|
|
|
width: 100%;
|
|
|
|
padding: 12px;
|
|
|
|
top: 0;
|
|
|
|
|
|
|
|
&.showing {
|
|
|
|
top: $headerHeight;
|
|
|
|
z-index: 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
input[type="search"] {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|