Skip to content

Commit 7dd0ee6

Browse files
committed
fix(RadioButtonSelecter): add closeList method preventing the no method error
1 parent 8835f5e commit 7dd0ee6

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

components/Panel/Item/FilterPanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@
406406
* Save the current tagSelecter or close a tag selecter if previously activated
407407
* @param tagSelecter
408408
*/
409-
toggleList(tagSelecter: CheckBoxSelecter) {
409+
toggleList(tagSelecter: CheckBoxSelecter | RadioButtonSelecter) {
410410
if (this.selectedTagSelecter !== undefined) {
411411
// @ts-ignore
412412
this.selectedTagSelecter.closeList();

components/Search/RadioButtonSelecter.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Icon type="arrowRight"/>
55
<slot></slot>
66
</span>
7-
<ul :class="{active}">
7+
<ul :class="{active}" ref="list">
88
<li>
99
<input type="text" class="input--primary-color" v-model="filter" placeholder="Filtrer">
1010
</li>
@@ -27,7 +27,7 @@
2727
</template>
2828

2929
<script lang="ts">
30-
import {Vue, Component, Prop, Emit, Watch} from "vue-property-decorator";
30+
import {Vue, Component, Prop, Emit, Watch, Ref} from "vue-property-decorator";
3131
import Icon from "~/components/Symbols/Icon.vue";
3232
import {RadiobuttonObject, RadiobuttonSelecterObjectEmitted} from "~/types";
3333
@@ -43,6 +43,8 @@
4343
@Prop({type: Array, required: true}) readonly defaultOptions!: RadiobuttonObject[];
4444
@Prop({default: 'default'}) readonly defaultValue!: any;
4545
@Prop({type: Boolean, default: false}) readonly selectDefaultOption!: boolean;
46+
@Ref() list!: HTMLElement;
47+
4648
4749
selectedValue: any = this.defaultValue;
4850
@@ -80,6 +82,19 @@
8082
@Emit()
8183
toggleList() {
8284
this.active = !this.active;
85+
86+
if(this.active) {
87+
this.list.style.maxHeight = this.list.scrollHeight.toString() + "px";
88+
} else {
89+
this.list.style.maxHeight = "0";
90+
}
91+
92+
return this
93+
}
94+
95+
closeList(): RadioButtonSelecter {
96+
this.active = false;
97+
this.list.style.maxHeight = "0";
8398
return this
8499
}
85100

0 commit comments

Comments
 (0)