const iViewUtils = {};

iViewUtils.createSpin = (dom) => {
  let spinContent = '<div class="ivu-spin-main" style="height: auto">' +
        '<span class="ivu-spin-dot"></span>' +
        '<div class="ivu-spin-text"></div>' +
      '</div>';
  let spin = document.createElement('div');
  spin.className = 'ivu-spin ivu-spin-large ivu-spin-fix';
  spin.style.opacity = '0.6';
  spin.style.height = 'auto';
  spin.style.display = 'flex';
  spin.style.alignItems = 'center';
  spin.style.zIndex = '10000';
  spin.innerHTML = spinContent;
  dom.appendChild(spin);
};

iViewUtils.removeSpin = (dom) => {
  let spin = dom.querySelector('.ivu-spin');
  dom.removeChild(spin);
};

export default iViewUtils;
