Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引用到Chrome extension中弹幕不显示 #25

Open
OMP1024 opened this issue Nov 14, 2022 · 0 comments
Open

引用到Chrome extension中弹幕不显示 #25

OMP1024 opened this issue Nov 14, 2022 · 0 comments

Comments

@OMP1024
Copy link

OMP1024 commented Nov 14, 2022

const danmuContainer = () => { // 弹幕屏幕 const [screen, setScreen] = useState(null); // 弹幕内容 const [bullet, setBullet] = useState(""); const ref = useRef(null) useEffect(() => { let s = new BulletScreen(ref.current,{duration:10}); setScreen(s); }, []); // 弹幕内容输入事件处理 const handleChange = ({ target: { value } }) => { setBullet(value); }; // 发送弹幕 const handleSend = () => { if (bullet) { // push 纯文本 screen.push(bullet); } }; return ( <div className={style.danmu_container_root}> <div ref={ref} className={style.screen}></div> <input value={bullet} onChange={handleChange} /> <button onClick={handleSend}>发送</button> </div> ); };

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant