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 | <template> | 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 | </template> | 8 | </template> |
4 | <script> | 9 | <script> |
5 | import Emitter from '../../mixins/emitter'; | 10 | import Emitter from '../../mixins/emitter'; |
src/components/select/select.vue
@@ -337,6 +337,7 @@ | @@ -337,6 +337,7 @@ | ||
337 | }, | 337 | }, |
338 | getOptionData(value){ | 338 | getOptionData(value){ |
339 | const option = this.flatOptions.find(({componentOptions}) => componentOptions.propsData.value === value); | 339 | const option = this.flatOptions.find(({componentOptions}) => componentOptions.propsData.value === value); |
340 | + if (!option) return {}; | ||
340 | const textContent = option.componentOptions.children.reduce((str, child) => str + (child.text || ''), ''); | 341 | const textContent = option.componentOptions.children.reduce((str, child) => str + (child.text || ''), ''); |
341 | const label = option.componentOptions.propsData.label || textContent || ''; | 342 | const label = option.componentOptions.propsData.label || textContent || ''; |
342 | return { | 343 | return { |
@@ -389,6 +390,7 @@ | @@ -389,6 +390,7 @@ | ||
389 | this.visible = typeof force !== 'undefined' ? force : !this.visible; | 390 | this.visible = typeof force !== 'undefined' ? force : !this.visible; |
390 | if (this.visible){ | 391 | if (this.visible){ |
391 | this.dropDownWidth = this.$el.getBoundingClientRect().width; | 392 | this.dropDownWidth = this.$el.getBoundingClientRect().width; |
393 | + this.broadcast('Drop', 'on-update-popper'); | ||
392 | } | 394 | } |
393 | }, | 395 | }, |
394 | hideMenu () { | 396 | hideMenu () { |
@@ -598,6 +600,9 @@ | @@ -598,6 +600,9 @@ | ||
598 | if (topOverflowDistance < 0) { | 600 | if (topOverflowDistance < 0) { |
599 | this.$refs.dropdown.$el.scrollTop += topOverflowDistance; | 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 | }; |