mirror of
https://github.com/Lissy93/dashy.git
synced 2024-11-30 11:32:10 +03:00
Allows cancel of filter by pressing Esc key, or the Clear icon in search field
This commit is contained in:
parent
3b47a88dff
commit
c7308a2909
@ -6,7 +6,12 @@
|
|||||||
id="filter-tiles"
|
id="filter-tiles"
|
||||||
v-model="input"
|
v-model="input"
|
||||||
placeholder="Start typing to filter tiles..."
|
placeholder="Start typing to filter tiles..."
|
||||||
v-on:input="userIsTypingSomething" />
|
v-on:input="userIsTypingSomething"
|
||||||
|
@keydown.esc="clearFilterInput" />
|
||||||
|
<i v-if="input.length > 0"
|
||||||
|
class="el-icon-circle-close clear-search"
|
||||||
|
title="Clear search"
|
||||||
|
@click="clearFilterInput"></i>
|
||||||
</form>
|
</form>
|
||||||
<div class="space-filler"></div>
|
<div class="space-filler"></div>
|
||||||
</section>
|
</section>
|
||||||
@ -24,6 +29,11 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
userIsTypingSomething () {
|
userIsTypingSomething () {
|
||||||
this.$emit('user-is-searchin', this.input)
|
this.$emit('user-is-searchin', this.input)
|
||||||
|
},
|
||||||
|
clearFilterInput () {
|
||||||
|
console.log('Esc key pressed')
|
||||||
|
this.input = ''
|
||||||
|
this.userIsTypingSomething()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,6 +75,18 @@ export default {
|
|||||||
background: #607d8b4a;
|
background: #607d8b4a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.clear-search {
|
||||||
|
position: absolute;
|
||||||
|
margin: 1em 0 0 -2em;
|
||||||
|
color: #1CA8DD;
|
||||||
|
opacity: 0.5;
|
||||||
|
border-radius: 50px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
opacity: 1;
|
||||||
|
background: #282a32;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.space-filler {
|
.space-filler {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user