基础,当点击切换按钮时,React抛出“el.data(...)。split不是函数”

时间:2017-04-21 22:31:08

标签: reactjs zurb-foundation

当我从基础文档插入html块(下面)时,进入反应组件

  <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

1 个答案:

答案 0 :(得分:9)

问题在于数据切换属性。 反应渲染下面的行

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

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

如此指定=&#34;&#34;

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

修复了问题