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

@zeesuu/select

v1.0.17

Published

Configurable select component for vue. Base on Element-ui.

Downloads

1

Readme

@zeesuu/select

可以从远程接口直接获取数据的下拉框组件.

在入口文件中配置后, 页面中直接使用即可.

安装:

$ npm i @zeesuu/select -S

使用:

全局使用

main.js

import ZeesuuSelect from '@zeesuu/select';

Vue.use(ZeesuuSelect, {
  // 传入一组 API 配置
  api: {
    // 此处为配置和组件的名称, 使用camelCase命名, 在组件使用的时候将camelCase换成带dash的小写名称. 例: <role-list>
    roleList: {
      // select 对应的接口
      url: '/v1/sys/role/all_role_list',
      // 对应文字的接口返回数据字段
      label: 'name',
      // 对应值的接口返回数据字段
      value: 'id',
      // 返回体中,结果所在的key值(可选,默认就是返回体本身)
      key: 'rows',
    },
    // 自定义数据集
    custom: {
      // 定义名称
      orderSl: [
        // 定义数据
        {
          label: '第一个',
          value: '0',
        },
        {
          label: '第二个',
          value: '1',
        },
      ],
    },
  },
});

页面中

  1. 筛选项
<template>
  <div class="dashboard-container">
    <search-list :option="searchOpt" ...></search-list>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        searchOpt: [
          {
            // 此处type只要写上 在main中配置的API的key,即可直接使用select.
            // 组件会完成初始化,获取数据.
            type: 'roleList',
            name: 'role_id',
            label: '角色',
            conf: {
              // 如果当前roleList对应的接口需要传入参数, 请配置 conf.params
              params: {
                type: 1,
              },
            },
          },
          {
            type: 'orderSl',
            name: 'order',
            label: '顺序',
          },
        ],
      };
    },
  };
</script>
  1. 直接使用
<template>
  <div>
    <!-- 配置对应的变量, 和参数 -->
    <role-list v-model="role_id" :conf="{ params: { type: 1 } }"></role-list>
    <order-sl v-model="order"></order-sl>
  </div>
</template>

内置数据

目前内置了 'yesNo' 下拉框

<template>
  <!-- 是:1 否:2 -->
  <yes-no v-model="enable"></yes-no>
</template>

Dependencies

  1. this.$http

此组件依赖调用环境的 this.$http 是用于发起请求的对象实例,比如 axios.

没有的话,则无法完成远程调用.

  1. Element-ui

此组件依赖调用环境需要安装 Element-ui