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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-scan-code

v1.1.5

Published

a code scanning plug-in for vue

Downloads

23

Readme

vue-scan使用指南 vue-scan是基于vue开发的一款web扫码枪vue插件

使用 - 基本使用

在项目的main.js中引入vue-scan-code插件, 入下图

import Vue from 'vue'
import vueScanCode from 'vue-scan-code'

const options = {
    scanName: 'scan', // default 'scan' 初始化挂在vue原型上的名称: 如 scanName = 'scantest' 那么在vue实例中this.$scantest可以获取该实例
    scanWait: 30, // default 30(ms) 应用接收扫码枪的频率,默认30ms,性能低的机器可适当增加该值
    scanCodeMinLength: 5 // default 5 接收条码的最小长度,当条码长度小于该值时,不做任何响应
}
Vue.use(vueScanCode, options)

new Vue({
    ...
})

在需要绑定扫码监听的组件上

组件 mine.vue

<template>
    <div></div>
</template>

export default {
    mounted () {
    this.$scan.bindScanCode(this, (code) => {
        console.log('条形码是:', code)
    })
    },
    destroyed () {
    this.$scan.offScanCode(this)
    }
}

<style lang="less">
</style>

this['$'+ options.scanName].bindScanCode(this, callback)
绑定组件的扫码监听 
   该方法有两个参数,第一个为当前组件的上下文this, 第二个是回调函数callback

this['$'+ options.scanName].offScanCode(this)
// 解除组件的扫码监听 
该方法只有一个参数,当前组件的上下文this

注意在当页面应用中,如果你没有解除逐渐的扫码监听, 当你离开绑定组件扫码组件页面进行扫码,依然可以接收和触发绑定的事件

当多个组件绑定扫码监听时,以最后绑定的监听为主。

github repositories