<template>
  <div>
    <!-- 逐题提交 -->
    <Progressive
    @close="close"
      v-if="commitType == 1"
    :form='form'

    />
    <!-- 常规 -->
    <Continuous
    @close='close'
      v-else
      :form='form'
    />
  </div>
</template>
<script>
import Vue from "vue";
import Continuous from "./component/Continuous";
import Progressive from "./component/Progressive";
import {
  Button,
  Popup,
  Cell,
  CellGroup,
  Field,
  Image,
  Loading,
  RadioGroup,
  Radio,
  CheckboxGroup,
  Checkbox,
  Dialog,
  ImagePreview,
  Slider,
  Form,
  GoodsActionButton,
  GoodsAction,
  Tag,
  Uploader
} from "vant";
Vue.use(Button)
  .use(Popup)
  .use(Slider)
  .use(Dialog)
  .use(Form)
  .use(Cell)
  .use(CellGroup)
  .use(Field)
  .use(Image)
  .use(Loading)
  .use(RadioGroup)
  .use(Radio)
  .use(CheckboxGroup)
  .use(Checkbox)
  .use(ImagePreview).use(GoodsActionButton).use(GoodsAction).use(Tag).use(Uploader);
import 'vant/lib/index.css'
export default {
  props:['form'],
  components: {
    Continuous,
    Progressive,
  },
  data() {
    return {
      loginFlag: true,
      commitType: 0, // 1是逐题提交 0.一起提交
      preView: false,
    };
  },
  mounted() {
    this.commitType = this.form.commitType;
    // window.addEventListener("message", this.handleMessage);
    // this.$emit("load");
  },
  methods: {
    // handleMessage(e) {
    //   var data = e.data;
    //   if (data.cmd == "getFormJson") {
    //     this.loginFlag = data.data.loginFlag;
    //     this.commitType = data.data.commitType;
    //     this.preView = true;
    //     this.questionList = data.data.questionnaireQuestionList;
    //     console.log(this.questionList, data.data);
    //   }
    // },
    close(){
      this.$emit('close')
    }
  },
};
</script>

<style lang="scss" scoped>
/deep/.icon-weigouxuan {
  border: 1px solid #ccc;
  border-radius: 50%;
}

</style>
