-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathexampleFiltered.vue
58 lines (54 loc) · 1.11 KB
/
exampleFiltered.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<div class="example">
<h2>Filtered picker example</h2>
<div class="row">
Picker with filtered data, only emojis with names matching the `/^flag.*/`
regexp.
</div>
<div class="row">
<button @click="toggleFlagsVisible">
Show / hide the flags picker (with v-show)
</button>
</div>
<div class="row" v-show="flagsVisible">
<Picker
:native="true"
emoji="flag-tf"
:emojiSize="18"
:data="indexFiltered"
ref="flags"
/>
</div>
</div>
</template>
<script>
import data from '../data/all.json'
import { Picker, EmojiIndex } from '../src'
let indexFiltered = new EmojiIndex(data, {
emojisToShowFilter: (emoji) => {
return emoji.short_names[0].match(/^flag.*/) !== null
},
})
export default {
props: {
index: {
type: Object,
},
},
data() {
return {
indexFiltered: indexFiltered,
flagsVisible: true,
}
},
methods: {
toggleFlagsVisible() {
this.flagsVisible = !this.flagsVisible
},
},
components: {
Picker,
},
}
</script>
<style scoped></style>