Write less code, do more things!

文档

基础使用

markdown

var React = require('react')
var Position = require('position.react')
class Basic extends React.Component {
    constructor (props) {
        super(props)
        this.state = {
            height:20
        }
        const self = this
        setTimeout(function callee () {
            self.setState({
                height: Math.random() * 100
            })
            setTimeout(callee, 500)
        }, 500)
    }
    render () {
        const self = this
        return (
            <div
                ref={(node) => {
                    self.$refs = self.$refs || {}
                    self.$refs.root = node
                }}
                style={{position: 'relative', border: '1px solid blue'}}
            >
                <div style={{height: self.state.height}} >abcdef</div>
                <Position
                   target={function() {
                       return self.$refs.root
                   }}
                   baseOn={{
                       target: 'left bottom'
                   }}
                   onAlign={function(position, el, target, offsetParent) {
                       position.top = position.top + 10
                       return position
                   }}
               >
                   <div style={{width: 100, height:100, background: "pink", opacity: .8}} ></div>
               </Position>
            </div>
        )
    }
}

module.exports = Basic

Github
position.react - 项目源码
相关站点
component-spec - 组件规范
module - 开源项目脚手架
onface.cc - 资源集合