This repository was archived by the owner on Jun 13, 2021. It is now read-only.
File tree 3 files changed +23
-9
lines changed
3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 6
6
<div class =" flags-dropdown-arrow" />
7
7
<RegionInput
8
8
:value =" value"
9
- @input =" onInput($event) "
9
+ @input =" onInput"
10
10
@up =" onUp"
11
11
@down =" onDown"
12
- @enter =" onEnter "
12
+ @enter =" onSelectRegion "
13
13
@reset =" onReset"
14
14
/>
15
15
<RegionsList
16
16
:regions =" filteredRegions"
17
17
:filter =" value"
18
18
:highlighted-index =" highlightedIndex"
19
- :selected-region =" selectedRegion"
19
+ :selected =" selectedRegion"
20
+ @highlight =" onHighlightRegion"
21
+ @select =" onSelectRegion"
20
22
/>
21
23
<a
22
24
:href =" moreParameters.href"
@@ -72,11 +74,14 @@ export default {
72
74
this .highlightedIndex += 1 ;
73
75
}
74
76
},
75
- onInput (event ) {
76
- this .value = event ;
77
+ onHighlightRegion (region ) {
78
+ this .highlightedIndex = this .filteredRegions .findIndex (reg => reg .name === region .name );
79
+ },
80
+ onInput (value ) {
81
+ this .value = value;
77
82
this .highlightedIndex = 0 ;
78
83
},
79
- onEnter () {
84
+ onSelectRegion () {
80
85
const updatedCookieString = this .cookieString
81
86
.split (' :' )
82
87
.map ((paramString ) => {
Original file line number Diff line number Diff line change 2
2
<li
3
3
:data-selected =" region.locale"
4
4
:class =" { [$style.highlighted]: highlighted }"
5
+ @mouseenter =" $emit('highlight', region)"
6
+ @click =" $emit('select')"
5
7
>
6
8
<span :class =" `flag ${country}`" />
7
9
{{ region.name }}
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" flags-dropdown-body" >
3
3
<p class =" flags-dropdown-chosen js-select-chosen" >
4
- <span :class =" selectedRegion .class" />
5
- <strong class =" js-selected-text" >{{ selectedRegion .name }}</strong >
4
+ <span :class =" selected .class" />
5
+ <strong class =" js-selected-text" >{{ selected .name }}</strong >
6
6
</p >
7
7
<ul class =" flags-dropdown-list" >
8
8
<RegionItem
9
9
v-for =" (region, index) in regions"
10
10
:key =" region.id"
11
11
:region =" region"
12
12
:highlighted =" index === highlightedIndex"
13
+ @highlight =" highlight"
14
+ @select =" $emit('select')"
13
15
/>
14
16
</ul >
15
17
</div >
@@ -27,7 +29,12 @@ export default {
27
29
regions: { type: Object , required: true },
28
30
filter: { type: String , required: true },
29
31
highlightedIndex: { type: Number , required: true },
30
- selectedRegion: { type: Object , default : () => ({}) },
32
+ selected: { type: Object , default : () => ({}) },
33
+ },
34
+ methods: {
35
+ highlight (region ) {
36
+ this .$emit (' highlight' , region);
37
+ },
31
38
},
32
39
};
33
40
</script >
You can’t perform that action at this time.
0 commit comments