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

vue2.0-suggest

v1.0.1

Published

Suggest component based on Vue2.0

Downloads

7

Readme

vue2.0-suggest

Suggest component based on Vue2.0, built-in function throttling, supports mouseover/mouseleave event, and supports option customized lightly

api

/*
 * disable - 组件的禁用状态
 * debounce - on-input-change的节流周期,默认300ms
 * placeholder - placeholder,默认「请输入」
 * label - 渲染在下拉项中的内容,默认「name」,当使用slot指定option的渲染内容时,该属性被忽略
 * code - 下拉项选中时同步给model的字段,默认「code」
 * data - 下拉列表数据
 * on-input-change - 输入框内容改变事件
 * on-select - 下拉项选中事件
 * on-option-hover - 下拉项鼠标mouseover事件
 * on-selection-leave - 下拉框mouseleave事件
 */

usage

npm

  1. install the package
$ npm install vue2.0-suggest
  1. register the component import suggest from 'vue2.0-suggest' Vue.use(suggest);
  2. use
<Suggest
  class="dis-ib w300"
  :data="list"
  v-model="target"
  @on-select="handleSelect"
  @on-input-change="handleSuggest"
/>

CDN

not supported yet

example

<template>
  <div id="app">
    <span>city:</span>
    <Suggest
      class="dis-ib w300"
      :data="list"
      v-model="target"
      @on-select="handleSelect"
      @on-input-change="handleSuggest"
    />
  </div>
</template>

<script>

export default {
  name: 'App',
  data() {
    return {
      list: [],
      target: '',
    };
  },
  methods: {
    handleSelect() {

    },
    handleSuggest(val) {
      const newList = [];
      const count = Math.round((Math.random(0, 1) * 10)) + 3;
      for (let i = 0; i < count; i += 1) {
        newList.push({
          code: i,
          name: `${val}--${i}`,
        });
      }
      this.list = newList;
    },
  },
};
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>