12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import { connect } from 'herculex';
- Component(connect({
- mapStateToProps: {
- cityCode: state => state.$global.cityCode
- }
- })({
- props: {
- componentData: {}
- },
- data: {
- isReady: false,
- pluginAppId: '',
- pluginComponent: '',
- pluginVersion: ''
- },
- didMount() {
- const {
- componentData: {
- componentExtInfo
- }
- } = this.props;
- const {
- pluginAppId,
- pluginComponent,
- pluginVersion
- } = componentExtInfo;
- this.setData({
- pluginAppId,
- pluginComponent,
- pluginVersion
- });
- this.loadPlugin();
- },
- methods: {
- onHeadHeight(height) {
- this.commitGlobal && this.commitGlobal({
- headB2bHight: height
- });
- },
- onChangeStore(e) {
- const {
- cityCode,
- storeId
- } = e;
- this.commitGlobal && this.commitGlobal({
- cityCode,
- globalShopId: storeId,
- globalShop: { ...e
- }
- });
- },
- loadPlugin() {
- const {
- pluginAppId,
- pluginVersion
- } = this.data;
- const that = this;
- my.loadPlugin({
- plugin: `${pluginAppId}@${pluginVersion}`,
- success: () => {
- that.setData({
- isReady: true
- });
- }
- });
- }
- }
- }));
|