12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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!');
- }
- }
- }
- });
|