Skip to content

Commit

Permalink
Cascader: hoverThreshold configuable
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzinlife committed Nov 6, 2017
1 parent e185200 commit e1865b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/cascader/src/main.vue
Expand Up @@ -149,6 +149,10 @@ export default {
beforeFilter: {
type: Function,
default: () => (() => {})
},
hoverThreshold: {
type: Number,
default: 500
}
},
Expand Down Expand Up @@ -224,6 +228,7 @@ export default {
this.menu.expandTrigger = this.expandTrigger;
this.menu.changeOnSelect = this.changeOnSelect;
this.menu.popperClass = this.popperClass;
this.menu.hoverThreshold = this.hoverThreshold;
this.popperElm = this.menu.$el;
this.menu.$on('pick', this.handlePick);
this.menu.$on('activeItemChange', this.handleActiveItemChange);
Expand Down
10 changes: 5 additions & 5 deletions packages/cascader/src/menu.vue
Expand Up @@ -39,7 +39,8 @@
value: [],
expandTrigger: 'click',
changeOnSelect: false,
popperClass: ''
popperClass: '',
hoverTimer: 0
};
},
Expand Down Expand Up @@ -135,13 +136,12 @@
activeOptions,
visible,
expandTrigger,
popperClass
popperClass,
hoverThreshold
} = this;
let hoverMenuRefs = {};
this.hoverTimer = null;
const hoverMenuHandler = e => {
const hoverHreshold = 500;
const offsetX = e.offsetX;
const width = hoverMenuRefs.activeMenu.offsetWidth;
const height = hoverMenuRefs.activeMenu.offsetHeight;
Expand All @@ -160,7 +160,7 @@
if (!this.hoverTimer) {
this.hoverTimer = setTimeout(() => {
hoverMenuRefs.hoverZone.innerHTML = '';
}, hoverHreshold);
}, hoverThreshold);
}
}
};
Expand Down

0 comments on commit e1865b0

Please sign in to comment.