import * as React from "react";
import Util from '../../util/utils'

type LPData = {
    cptCode: number, //组件代码
    cptType: number,
    content?: any

    [propsName: string]: any
}

interface IPropTypes {
    data: Array<LPData>,
}

class MShop extends React.Component<IPropTypes, any> {
    constructor(props: IPropTypes) {
        super(props);
        this.state = {
            source: [],
        }
    }

    componentDidMount(): void {

    }

    onClick() {

    }

    render() {
        let source = this.props.data;
        return (
            <div className={'m-shop'}>
                {
                    source && source.length > 0 ?
                        source.map((data: any, index: any) => {
                            return (
                                <div key={index} className={'shop-component'}>
                                    {Util.transInReactNode(data)}
                                </div>
                            )
                        }) : ''
                }
            </div>
        );
    }
}

export default MShop;