import Questionnaire from './Questionnaire';
import render from '../_utils/component-render';
const createQuestionnaire = render(Questionnaire);
export default function open(position) {
  if (!position) throw new Error('缺少参数 position');
  const vm = createQuestionnaire();
  const promise = vm.getInfo(position).then(isTrue => {
    if (isTrue) return vm.run();
  }).catch(() => {
    return false;
  });
  promise.vm = vm;
  return promise;
}