<template>
  <render ref="render" v-if="showRender" @reload="reload"></render>
</template>

<script>
import render from "./render";

export default {
  name: "h5_view",
  components: {render},
  props: {
    _dataId: {
      type: [String, Number],
      default: () => null
    },
    code: {
      type: String,
      default: () => null
    },
    wfEnabled: {
      type: [String, Boolean],
      default: () => false
    },
  },
  data() {
    return {
      showRender: true
    }
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this.$refs.render.init({
        code: this.code,
        dataId: this._dataId,
        wfEnabled: this.wfEnabled
      });
    },
    reload() {
      this.showRender = false;
      this.$nextTick(() => {
        this.showRender = true;
        this.$nextTick(() => {
          this.init();
        })
      })
    }
  }
}
</script>

<style scoped>

</style>
