Commit cf753854d120cf27b7fdf00c94e098eb34db0294
1 parent
afef4ce7
Corrections after review input
Showing
2 changed files
with
11 additions
and
1 deletions
Show diff stats
src/components/select/option.vue
1 | 1 | <template> |
2 | - <li :class="classes" @click.stop="select"><slot>{{ showLabel }}</slot></li> | |
2 | + <li | |
3 | + :class="classes" | |
4 | + @click.stop="select" | |
5 | + @mousedown.prevent | |
6 | + @touchstart.prevent | |
7 | + ><slot>{{ showLabel }}</slot></li> | |
3 | 8 | </template> |
4 | 9 | <script> |
5 | 10 | import Emitter from '../../mixins/emitter'; | ... | ... |
src/components/select/select.vue
... | ... | @@ -337,6 +337,7 @@ |
337 | 337 | }, |
338 | 338 | getOptionData(value){ |
339 | 339 | const option = this.flatOptions.find(({componentOptions}) => componentOptions.propsData.value === value); |
340 | + if (!option) return {}; | |
340 | 341 | const textContent = option.componentOptions.children.reduce((str, child) => str + (child.text || ''), ''); |
341 | 342 | const label = option.componentOptions.propsData.label || textContent || ''; |
342 | 343 | return { |
... | ... | @@ -389,6 +390,7 @@ |
389 | 390 | this.visible = typeof force !== 'undefined' ? force : !this.visible; |
390 | 391 | if (this.visible){ |
391 | 392 | this.dropDownWidth = this.$el.getBoundingClientRect().width; |
393 | + this.broadcast('Drop', 'on-update-popper'); | |
392 | 394 | } |
393 | 395 | }, |
394 | 396 | hideMenu () { |
... | ... | @@ -598,6 +600,9 @@ |
598 | 600 | if (topOverflowDistance < 0) { |
599 | 601 | this.$refs.dropdown.$el.scrollTop += topOverflowDistance; |
600 | 602 | } |
603 | + }, | |
604 | + dropVisible(open){ | |
605 | + this.broadcast('Drop', open ? 'on-update-popper' : 'on-destroy-popper'); | |
601 | 606 | } |
602 | 607 | } |
603 | 608 | }; | ... | ... |