Component({
  props: {
    componentData: {}
  },
  data: {
    isReady: false,
    pluginAppId: '',
    pluginComponent: '',
    pluginVersion: '',
    fmcg: {}
  },

  didMount() {
    const {
      componentData: {
        componentExtInfo
      }
    } = this.props;
    const {
      query
    } = my.getLaunchOptionsSync() || {};
    const {
      pluginAppId,
      pluginComponent,
      pluginVersion
    } = componentExtInfo;
    this.setData({
      pluginAppId,
      pluginComponent,
      pluginVersion,
      fmcg: query || {}
    });
    this.loadPlugin();
  },

  methods: {
    loadPlugin() {
      const {
        pluginVersion,
        pluginAppId
      } = this.data;

      try {
        my.loadPlugin({
          plugin: `${pluginAppId}@${pluginVersion}`,
          success: () => {
            this.setData({
              isReady: true
            });
          }
        });
      } catch (e) {
        throw new Error('plugin must be pluginAppId and pluginVersion, please configure on AB saas！');
      }
    }

  }
});