gpt4 book ai didi

reactjs - Foundation,React 在单击切换按钮时抛出 "el.data(...).split is not a function"

转载 作者:行者123 更新时间:2023-12-03 13:57:24 26 4
gpt4 key购买 nike

当我将 html block (如下)从基础文档插入到 React 组件中时

  <div className="top-bar" id="top-bar">
<div className="top-bar-title">
<span data-responsive-toggle="responsive-menu" data-hide-for="medium">
<button className="menu-icon dark" type="button" data-toggle></button>
</span>
<strong>Site Title</strong>
</div>
<div id="responsive-menu">
<div className="top-bar-left">
<ul className="dropdown menu" data-dropdown-menu>
<li>
<a href="#">One</a>
<ul className="menu vertical">
<li><a href="#">One</a></li>
<li><a href="#">Two</a></li>
<li><a href="#">Three</a></li>
</ul>
</li>
<li><a href="#">Two</a></li>
<li><a href="#">Three</a></li>
</ul>
</div>
<div className="top-bar-right">
<ul className="menu">
<li><input type="search" placeholder="Search"/></li>
<li><button type="button" className="button">Search</button></li>
</ul>
</div>
</div>
</div>

点击切换按钮时抛出错误

el.data(...).split is not a function

最佳答案

问题出在 data-toggle 属性上。 react 渲染下面的行

    <button className="menu-icon dark" type="button" data-toggle></button>

    <button class="menu-icon dark" type="button" data-toggle="true"></button>

所以指定=“”

    <button className="menu-icon dark" type="button" data-toggle=""></button>

解决问题

关于reactjs - Foundation,React 在单击切换按钮时抛出 "el.data(...).split is not a function",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43552945/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com