/**
 * 获取最近的一个弹框组件
 * 包括对话框的测滑
*/
export function getClosestPopup(vm) {
  if (!vm) {
    return
  }
  const popups = ['UiDialog', 'UiDrawer']
  let popup
  let target = vm
  while (!popup && target) {
    if (target && popups.includes(target.$options.name)) {
      popup = target
    } else {
      target = target.$parent
    }
  }
  return popup
}
