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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue2-handwriting-input

v0.0.1

Published

Vue2手写输入识别组件,支持中文手写识别

Readme

Vue2 手写输入组件

一个基于Vue2的手写输入识别组件,支持中文手写识别。

特性

  • 🖊️ 支持手写输入识别
  • 🎯 多候选词选择
  • 🎨 自定义样式配置
  • 📱 移动端友好
  • 🌙 暗色主题支持
  • 🔧 TypeScript 类型支持

安装

npm install vue2-handwriting-input

使用方法

全局注册

import Vue from 'vue'
import HandwritingInput from 'vue2-handwriting-input'

Vue.use(HandwritingInput)

局部注册

import { HandwritingInput } from 'vue2-handwriting-input'

export default {
  components: {
    HandwritingInput
  }
}

基础用法

<template>
  <div>
    <HandwritingInput
      @text-selected="onTextSelected"
      @text-recognized="onTextRecognized"
    />
  </div>
</template>

<script>
export default {
  methods: {
    onTextSelected(text) {
      console.log('选中的文字:', text)
    },
    onTextRecognized(options) {
      console.log('识别结果:', options)
    }
  }
}
</script>

API

Props

| 参数 | 说明 | 类型 | 默认值 | |------|------|------|--------| | width | 画布宽度 | String/Number | '100%' | | height | 画布高度 | String/Number | 300 | | showControls | 是否显示控制按钮 | Boolean | true | | language | 识别语言 | String | 'zh_CN' | | apiUrl | 识别API地址 | String | 默认API | | strokeWidth | 笔画宽度 | Number | 3 | | strokeColor | 笔画颜色 | String | 'auto' |

Events

| 事件名 | 说明 | 回调参数 | |--------|------|----------| | text-selected | 用户选择文字时触发 | (text: string) | | text-recognized | 识别完成时触发 | (options: string[]) | | error | 识别失败时触发 | (error: Error) | | cleared | 清除画布时触发 | - | | recognizing | 识别状态变化 | (isRecognizing: boolean) |

Methods

| 方法名 | 说明 | 参数 | 返回值 | |--------|------|------|--------| | clearCanvas | 清除画布 | - | - | | getText | 获取当前选中文字 | - | string | | getOptions | 获取所有识别选项 | - | string[] |

示例

自定义样式

<template>
  <HandwritingInput
    :height="400"
    :stroke-width="5"
    stroke-color="#ff6b6b"
    @text-selected="handleTextSelected"
  />
</template>

禁用控制按钮

<template>
  <HandwritingInput
    :show-controls="false"
    @text-selected="handleTextSelected"
  />
</template>

通过ref调用方法

<template>
  <div>
    <HandwritingInput ref="handwriting" />
    <button @click="clearInput">清除</button>
    <button @click="getCurrentText">获取文字</button>
  </div>
</template>

<script>
export default {
  methods: {
    clearInput() {
      this.$refs.handwriting.clearCanvas()
    },
    getCurrentText() {
      const text = this.$refs.handwriting.getText()
      console.log('当前文字:', text)
    }
  }
}
</script>

开发

# 安装依赖
npm install

# 开发模式
npm run serve

# 构建库
npm run build:lib

# 发布到私服
npm publish

许可证

MIT