import loadCallbacks from '../utils/callbacks';
import { filterOptions, transformOptions } from '../utils/transformLoadOptions';
export default {
  computed: {
    loadOptions() {
      console.log(this.$attrs, 'aaa');
      const { options = {}} = this.$attrs;
      const { extraData = {}} = this.$route.meta || {};
      const params = filterOptions(transformOptions(extraData));
      return {
        ...params,
        ...options,
        extraParams: {
          ...(params.extraParams ? params.extraParams : {}),
          ...(options.extraParams ? options.extraParams : {}),
        },
      };
    },
  },
  watch: {
  },
  mounted() {
    const { extraData = {}} = this.$route.meta || {};
    if (loadCallbacks.hasOwnProperty(extraData.loadMode)) {
      loadCallbacks[extraData.loadMode].call(this.$refs.withScopeId, this.loadOptions);
    }
  },
  methods: {},
  destroyed() {
    const { scopeId } = this.loadOptions;
    if (scopeId) {
      Eui.Ipc.clearScope(scopeId);
    }
  },
};
