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

y-multi-cascader

v1.0.3

Published

移动端3级级联多选组件

Downloads

5

Readme

移动端 3 级级联 (单选/多选)

install

  1. 安装: yarn add y-multi-cascader

options

| 属性 | 描述 | 格式 | 默认值 | | ----------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------ | | tree-data | 选择项节点数据 | TreeData | [] | | map | 节点数据映射,当数据源不是标准的[{key,value,children}] 格式时,可以通过 map 将对应字段映射 | TreeDataMap | { key:'key', value:'value', children:'children'} | | multi | 是否多选 | boolean | true | | title | 标题文本,可用 slot 替代 | string | '请选择' | | submit-text | 提交按钮文本 | string | '确认' | | selected | 当前选中项, 一般情况下,请使用 v-model 进行双双向绑定 ,如果多选情况下,selected 返回的是一个数组,如果是单选,则返回对象 | Array(多选) , Object(单选) | [] |

数据格式

// 结构化选项数据
type TreeData [
  {
    key: String | Number;
    value: any;
    children: Array<TreeData>
  }
]
// 字段映射
type TreeDataMap {
  key: String
  value: String
  children: String
}

example

<template>
  <!-- 默认写法 -->
  <multi-cascader
            v-model="selection"
            ref="cascader"
            title="选择"
            multi
            :tree-data="treeList"
  />
  <!-- tree data 结构映射 -->
  <multi-cascader
            v-model="selection"
            ref="cascader"
            title="选择"
            multi
            :tree-data="treeList"
            :map="{
              key: 'key',
              value: 'value',
              children: 'children'
            }"
  />
  <!-- 单选用法 -->
  <multi-cascader
            v-model="checked"
            ref="cascader"
            title="选择"
            :multi="false"
            :tree-data="treeList"
  />
</template>

<script>
import MultiCascader from 'y-multi-cascader'


export default {
  components: {
    MultiCascader
  },
  data: {
    checked: null,
    selection: [],
    treeList:[
      {
        key:'a',
        value:'b',
        children:[
          {
            key:'a',
            value:'b',
            children:[
              key:'a',
              value:'b'
            ]
          }
        ]
      }
    ]
  },
  methods:{
    open() {
        this.$refs.cascader.open() // 注意: 级联器开关通过 内置方法实现, v-model绑定的是选中数据
    }
  }

}

</script>

slots 插槽

| 插槽 | 描述 | | ------ | ------------ | | header | 自定义标题栏 |

备注

如果要定制化修改, 请 fork 仓库, 并将组件移动到你的公共组件目录下