index.js 1.1 KB
import React from 'react';
import yaSDK from 'yoho-activity-sdk';

import './index.scss';
export default class BottomButton extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        const linkArr = this.props.links;
        
        if (!linkArr || !linkArr.length) {
            return null;
        }
        
        let jump = e => {
            let $el = e.currentTarget;
            let url = $el.getAttribute('data-url');

            if (!url) {
                return;
            }
            yaSDK.link(e)
        };
        
        return (
            <div className="comp-bottom-btns-wrap">
                {
                    linkArr.map((link, idx) => {
                        return (
                            <a data-type='other' data-url={link.url} 
                               className="button-item" key={idx} onClick={jump}>
                                <img className="btn-item-bg" src={link.bg}/>
                            </a>
                        )
                    })
                }
       
            </div>
        )
    }
}