zoukankan      html  css  js  c++  java
  • React(0.13) 定义一个使用动画

    <!DOCTYPE html>
    <html>
        <head>
            <title>React JS</title>
            <script src="../build_0.13/react.js"></script>
            <script src="../build_0.13/JSXTransformer.js"></script>
            <script src="../build_0.13/react-with-addons.min.js"></script>
            <style type="text/css">
                .example-enter{color:red;}
                .example-active{color:green;}
            </style>
        </head>
        <body>
            <div id="example" ></div>
            <script type="text/jsx">
                var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; 
                var TodoList = React.createClass({ 
                    getInitialState: function() { 
                        return {items: ['hello', 'world', 'click', 'me']}; 
                    }, 
                    handleAdd: function() { 
                        var newItems = this.state.items.concat([prompt('Enter some text')]); 
                        this.setState({items: newItems}); 
                    },
                    handleRemove: function(i) { 
                        var newItems = this.state.items; 
                        newItems.splice(i, 1); 
                        this.setState({items: newItems}); 
                    }, 
                    render: function() { 
                        var items = this.state.items.map(function(item, i) {
                                 return ( 
                                     <div key={item} onClick={this.handleRemove.bind(this, i)}> {item} </div> ); 
                                 }.bind(this)); 
                        return ( <div> 
                                     <button onClick={this.handleAdd}>Add Item</button>         
                                     <ReactCSSTransitionGroup transitionName="example">
                                        {items}
                                    </ReactCSSTransitionGroup>
                                </div> ); 
                    } 
                });
                
                //将组件加到对应的元素上
                React.render( <TodoList />, document.getElementById('example') );
            </script>
        </body>
    </html>
  • 相关阅读:
    Django组件之contenttype
    DRF 分页
    DRF的解析器和渲染器
    DRF 权限 频率
    DRF 版本 认证
    django Rest Framework 视图和路由
    Serialzers 序列化组件
    FBV和CBV区别
    RESTful规范
    SecureCRT最佳配置方案
  • 原文地址:https://www.cnblogs.com/yuwensong/p/5320056.html
Copyright © 2011-2022 走看看