Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
better-gesture
Advanced tools
A gesture library compatible with multiple terminals (native, PC, mobile, Vue, applet)
文档地址: https://wensiyuanseven.github.io/better-gesture
npm install better-gesture
目前可以通过 unpkg.com/获取到最新版本的资源,在页面上引入js
文件即可开始使用。
<!-- 最新版本 -->
<script src='https://unpkg.com/better-gesture/lib/better-gesture.umd.min.js'></script>
<!-- 指定版本 -->
<script src='https://unpkg.com/better-gesture@0.1.6/lib/better-gesture.umd.min.js'></script>
<script src='https://unpkg.com/better-gesture/lib/better-gesture.umd.min.js'></script>
<div id="example"></div>
<script>
new BetterGesture(document.getElementById('example'), {
//拖拽
pressMove(evt) {
console.log(evt.deltaX, evt.deltaY)
},
// 旋转
rotate(evt) {
console.log(evt.angle)
},
// 缩放
pinch(evt) {
console.log(evt.zoom)
},
// 滑动
swipe(evt) {
console.log(evt.direction)
}
//......
})
</script>
import Vue from 'vue'
import gesture from 'better-gesture'
Vue.use(gesture)
<template>
<section class="example">
<div v-gesture:pressMove="pressMove" v-gesture:doubleTap="doubleTap"> </div>
</section>
</template>
<script>
export default {
methods: {
//拖拽
pressMove(evt) {
console.log(evt.deltaX, evt.deltaY)
},
// 旋转
rotate(evt) {
console.log(evt.angle)
},
// 缩放
pinch(evt) {
console.log(evt.zoom)
},
// 滑动
swipe(evt) {
console.log(evt.direction)
}
//......
}
}
</script>
建议使用catch捕获事件,否则易造成监听动画卡顿
<!-- wxml -->
<!-- 必须初始化事件touchstart,touchmove,touchend,touchcancel-->
<!-- 事件名必须定义为start,move,end,cancel -->
<!-- 事件名start,move,end,cancel已经在new BetterGesture()时注入过了,不需要在page中再次定义-->
<view class='container'>
<view
catch:touchstart="start"
catch:touchmove="move"
catch:touchend="end"
catch:touchcancel="cancel">
</view>
</view>
// js
import BetterGesture from './../utils/better-gesture.js'
Page({
onLoad() {
new BetterGesture(this, {
//拖拽
pressMove(evt) {
console.log(evt.deltaX, evt.deltaY)
},
// 旋转
rotate(evt) {
console.log(evt.angle)
},
// 缩放
pinch(evt) {
console.log(evt.zoom)
},
// 滑动
swipe(evt) {
console.log(evt.direction)
}
//......
})
}
})
FAQs
A gesture library compatible with multiple terminals (native, PC, mobile, Vue, applet)
The npm package better-gesture receives a total of 4 weekly downloads. As such, better-gesture popularity was classified as not popular.
We found that better-gesture demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.