prevent dispatch form event

when component import an Input, prevent dispatch event from Input to
Form
This commit is contained in:
梁灏 2017-03-13 18:58:31 +08:00
parent 4a5d5cc9f2
commit 21dad188c1
8 changed files with 92 additions and 54 deletions

View file

@ -165,4 +165,22 @@ export function scrollTop(el, from = 0, to, duration = 500) {
window.requestAnimationFrame(() => scroll(d, end, step));
}
scroll(from, to, step);
}
}
// Find components upward
function findComponentUpward (content, componentName, componentNames) {
if (typeof componentName === 'string') {
componentNames = [componentName];
} else {
componentNames = componentName;
}
let parent = content.$parent;
let name = parent.$options.name;
while (parent && (!name || componentNames.indexOf(name) < 0)) {
parent = parent.$parent;
if (parent) name = parent.$options.name;
}
return parent;
}
export {findComponentUpward};