omi/plugins/omi-finger
当耐特 99728d1a65
Update index.html
2018-05-28 09:56:48 +08:00
..
example/simple Update index.html 2018-05-28 09:56:48 +08:00
.babelrc omi 3.0 2018-05-03 10:46:34 +08:00
README.md Update README.md 2018-05-28 09:56:04 +08:00
demo.png omix 2018-02-25 16:05:31 +08:00
index.js omi 3.0 2018-05-03 10:46:34 +08:00
package-lock.json omi 3.0 2018-05-03 10:46:34 +08:00
package.json omi 3.0 2018-05-03 10:46:34 +08:00
webpack.config.js omi 3.0 2018-05-03 10:46:34 +08:00

README.md

omi-finger

Omi /AlloyFinger integration, support touch and gesture events in your Omi project.


Demo

https://tencent.github.io/omi/plugins/omi-finger/example/simple/

Install

npm i omi-finger

Usgae

import Omi from 'omi'
import OmiFinger from 'omi-finger'

class App extends Omi.Component {
    constructor(data) {
        super(data)
        this.handleTap = this.handleTap.bind(this)
        this.handleSwipe = this.handleSwipe.bind(this)

        this.wording = 'Tap or Swipe Me!'
    }

    handleTap(evt) {
        this.wording += '\r\nTap'
        this.update()
    }

    handleSwipe(evt) {
        this.wording+= '\r\nSwipe-' + evt.direction
        this.update()
    }

    render() {
        return <div>
            <OmiFinger  onTap={this.handleTap} onSwipe={this.handleSwipe}>
                <div class="touchArea" >
                    {this.wording}
                    </div>
            </OmiFinger>

        </div>
    }

    style() {
        return `.touchArea{
                    background-color: green;
                    width: 200px;
                    min-height: 200px;
                    text-align: center;
                    color:white;
                    height:auto;
                    white-space: pre-line;
                }`
    }
}

Omi.render(new App(), "#container")

License

This content is released under the MIT License.