import React, { useEffect, useState, useRef } from 'react';

function Industry() {
    const iframeRef = useRef(null);

    useEffect(() => {
        if (iframeRef.current) {
            iframeRef.current.contentWindow.addEventListener('message', (event) => {
                console.log(11111, event.data);
            });
        }

        return () => {
            if (iframeRef.current) {
                iframeRef.current.contentWindow.removeEventListener('message', (event) => {
                    console.log('Received message:', event.data);
                });
            }
        };
    }, []); // 空依赖数组确保只运行一次清理操作

    return (
        <div>
            <iframe ref={iframeRef} src="http://ds1.chenhaitech.com/chat/qcAjlNGBDeqI168Z"  className='w-[100%] h-screen'/>;
        </div>
    )

}

export default Industry;
