pull/165/head
tjz 7 years ago
parent 82575bda4a
commit 7a0a36499d

@ -48,6 +48,7 @@ The height of the input field for the select defaults to 32px. If size is set to
:defaultValue="['a1', 'b2']" :defaultValue="['a1', 'b2']"
style="width: 200px" style="width: 200px"
@change="handleChange" @change="handleChange"
@popupScroll="popupScroll"
> >
<a-select-option v-for="i in 25" :key="(i + 9).toString(36) + i"> <a-select-option v-for="i in 25" :key="(i + 9).toString(36) + i">
{{(i + 9).toString(36) + i}} {{(i + 9).toString(36) + i}}
@ -78,6 +79,9 @@ export default {
methods: { methods: {
handleChange(value) { handleChange(value) {
console.log(`Selected: ${value}`); console.log(`Selected: ${value}`);
},
popupScroll(){
console.log('popupScroll')
} }
} }
} }

@ -453,7 +453,7 @@
padding-left: 0; // Override default ul/ol padding-left: 0; // Override default ul/ol
list-style: none; list-style: none;
max-height: 250px; max-height: 250px;
// overflow: auto; overflow: auto;
&-item-group-list { &-item-group-list {
margin: 0; margin: 0;

@ -197,7 +197,9 @@ export default {
// visible: props.visible, // visible: props.visible,
}, },
class: className, class: className,
on: {}, on: {
...this.$listeners,
},
} }
if (props.id) { if (props.id) {
domProps.id = props.id domProps.id = props.id

@ -38,7 +38,7 @@ export default {
watch: { watch: {
visible (val) { visible (val) {
if (!val) { if (!val) {
this.lastVisible = false this.lastVisible = val
} }
}, },
}, },
@ -51,6 +51,7 @@ export default {
} }
this.lastVisible = props.visible this.lastVisible = props.visible
this.lastInputValue = props.inputValue this.lastInputValue = props.inputValue
this.prevVisible = this.visible
}, },
methods: { methods: {
scrollActiveItemToView () { scrollActiveItemToView () {
@ -89,7 +90,7 @@ export default {
firstActiveValue, firstActiveValue,
dropdownMenuStyle, dropdownMenuStyle,
} = props } = props
const { menuDeselect, menuSelect } = this.$listeners const { menuDeselect, menuSelect, popupScroll } = this.$listeners
if (menuItems && menuItems.length) { if (menuItems && menuItems.length) {
const selectedKeys = getSelectKeys(menuItems, value) const selectedKeys = getSelectKeys(menuItems, value)
const menuProps = { const menuProps = {
@ -103,6 +104,9 @@ export default {
style: dropdownMenuStyle, style: dropdownMenuStyle,
ref: 'menuRef', ref: 'menuRef',
} }
if (popupScroll) {
menuProps.on.scroll = popupScroll
}
if (multiple) { if (multiple) {
menuProps.on.deselect = menuDeselect menuProps.on.deselect = menuDeselect
menuProps.on.select = menuSelect menuProps.on.select = menuSelect
@ -160,7 +164,6 @@ export default {
}, },
render () { render () {
const renderMenu = this.renderMenu() const renderMenu = this.renderMenu()
this.prevVisible = this.visible
const { popupFocus, popupScroll } = this.$listeners const { popupFocus, popupScroll } = this.$listeners
return renderMenu ? ( return renderMenu ? (
<div <div

Loading…
Cancel
Save