onMouseOver不在react.js应用程序中工作

时间:2017-10-09 04:27:44

标签: javascript

我正在尝试使用onMouseOver来触发更新状态的函数。但是,在使用console.log测试onMouseOver时,它不会在悬停时向控制台吐出任何内容:

render: function() {

        return (

        <ReactCSSTransitionGroup transitionName="example" transitionAppear={true} transitionLeave={true} transitionEnterTimeout={600} transitionAppearTimeout={600} transitionLeaveTimeout={300}>


                    <ul className="icons">{ iconslist.map(function(i){
                            return <li key={i.id}><span className={i.class} id={i.id} data-id={i.data} onMouseOver={console.log("hello")}></span></li>

                        }) }

                    </ul>
                    <p className="icon-text">{iconslist[this.state.icon_id].name}</p>


        </ReactCSSTransitionGroup>

        );

    }

1 个答案:

答案 0 :(得分:1)

看起来你需要提供一个与调用console.log相反的回调。

+--------------------+----------------------------+-------------------------------------+
| C# DataType        | Related DB Column DataType | PK Column DataType & Length         |
+--------------------+----------------------------+-------------------------------------+ 
| int                | int                        | int, Identity column increment by 1 |
| string             | nvarchar(Max)              | nvarchar(128)                       |
| decimal            | decimal(18,2)              | decimal(18,2)                       |
| float              | real                       | real                                |
| byte[]             | varbinary(Max)             | varbinary(128)                      |
| datetime           | datetime                   | datetime                            |
| bool               | bit                        | bit                                 |
| byte               | tinyint                    | tinyint                             |
| short              | smallint                   | smallint                            |
| long               | bigint                     | bigint                              |
| double             | float                      | float                               |
| char               | No mapping                 | No mapping                          |
| sbyte              | No mapping                 |                                     |
| (throws exception) | No mapping                 |                                     |
| object             | No mapping                 | No mapping                          |
+--------------------+----------------------------+-------------------------------------+