Browse Source

优化

pull/9/head
tjz 7 years ago
parent
commit
8b95d85af9
  1. 4
      components/select/demo/size.md
  2. 2
      components/select/style/index.less
  3. 4
      components/vc-menu/MenuMixin.js
  4. 9
      components/vc-select/DropdownMenu.vue

4
components/select/demo/size.md

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

2
components/select/style/index.less

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

4
components/vc-menu/MenuMixin.js

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

9
components/vc-select/DropdownMenu.vue

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

Loading…
Cancel
Save