npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@maybecode/v-touchshow

v1.0.4

Published

基于[any-touch](https://github.com/any86/any-touch)手势库封装的Vue(2 & 3)的指令

Readme

v-touchshow

基于any-touch手势库封装的Vue(2 & 3)的指令

安装

Vue3

yarn add @maybecode/v-touchshow

Vue2

yarn add @maybecode/v-touchshow @vue/composition-api

注册

Vue3

import { createApp } from 'vue';
import VTouchshow from '@maybecode/v-touchshow'

const app = createApp();

app.use(VTouchshow);

Vue2

import Vue from 'vue';
import VTouchshow from '@maybecode/v-touchshow'

Vue.use(VTouchshow);

在线演示

Demo

具体使用

手势识别器支持事件对照表

| 识别器 | 事件名 | 说明 | | ---------- | ----------------------------------------------------------------- | ----------------------------------------------------- | | tap | tap | 单击 | | press | press / pressup | 按压 / 松开 | | pan | pan / panstart / panmove / panend /panup/pandown/panright/panleft | 拖拽 / 拖拽开始 / 拖拽进行中 / 拖拽结束/ 上下左右滑动 | | swipe | swipe / swipeup / swipedown / swiperight / swipeleft | 快划 / 不同方向快划 | | pinch | pinch / pinchstart / pinchmove / pinchend / pinchin /pinchout | 缩放 / 缩放开始 / 缩放进行中 / 缩放结束 / 放大 / 缩小 | | rotate | rotate / rotatestart / rotatemove / rotateend | 旋转 / 旋转开始 / 旋转进行中 / 旋转结束 |

可传入配置兼容any-touch

<div
    v-touchshow="config"
 >
</div>

1. 设置过渡动画

<style>

.block{
    transition: transform 0.3s ease-in-out; // 设置过渡动画
}
</style>

2. 编写模板代码

<template>
<div
    class="block"
    v-touchshow:swipeup="onSwipeup"
>
</div>
</template>

3. 处理事件回调

<script lang="ts" setup>
import { Callback } from '@maybecode/v-touchshow';

const onSwipeup: Callback = (e, el) => {
    el.style.transform = "translateY(-30vw)"
}
</script>

移动端尽量使用 tap 代理 click

在移动端 touchstart 比 click 先触发, 所以 touchstart 阶段的 preventDefault 会阻止 click 触发, 恰恰 any-touch 默认在 touchstart 中使用了preventDefault, 用来阻止了浏览器默认事件的触发,比如 click 和页面滚动.

如果移动端非要使用 click 做如下设置

v-touchshow="{ preventDefault: false }"

Browsers support

| Edge | Firefox | Chrome | Safari | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Edge | last 2 versions | last 2 versions | last 2 versions |

赞助

优先处理问题,以及定制化方案

License

MIT