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

diandi-ele-form-tree-select

v0.0.6

Published

diandi-ele-form 的树形选择框

Downloads

10

Readme

vue-ele-form-tree-select | vue-ele-form 的树形选择框

MIT Licence npm download

介绍

vue-ele-form-tree-select 做为 vue-ele-form 的第三方扩展, 通过对 vue-treeselect 的封装, 使得上传更加方便和容易

image

安装

yarn add vue-ele-form-tree-select

或者

npm install vue-ele-form-tree-select --save

全局注册并使用

import EleForm from 'vue-ele-form'
import EleFormTreeSelect from 'vue-ele-form-tree-select'

// 注册 tree-select 组件
Vue.component('tree-select', EleFormTreeSelect)

// 注册 ele-form
Vue.use(EleForm, {
  // 专门设置全局的 tree-select 属性
  // 属性参考: https://vue-treeselect.js.org/
  'tree-select': {
    clearable: true // 所有的 tree-select 都会有 clearable = true的属性值
  }
})

局部注册使用

局部注册和使用请参考: https://www.yuque.com/chaojie-vjiel/vbwzgu/inlpxy#I5kdQ

formDesc: {
  xxx: {
    label: 'xxx',
    // 只需要在这里指定为 tree-select 即可
    type: 'tree-select',
    // 属性参考: https://vue-treeselect.js.org/
    attrs: {
      multiple: true,
      clearable: true
    },
    options: [ {
      id: 'a',
      label: 'a',
      children: [ {
        id: 'aa',
        label: 'aa',
      }, {
        id: 'ab',
        label: 'ab',
      } ],
    }, {
      id: 'b',
      label: 'b',
    }, {
      id: 'c',
      label: 'c',
    } ]
  }
}

示例

<template>
  <el-card
    header="ele-form-tree-select 演示"
    shadow="never"
    style="max-width: 1250px;min-height: 1000px;margin: 20px auto;"
  >
    <ele-form
      :form-data="formData"
      :form-desc="formDesc"
      :request-fn="handleRequest"
      @request-success="handleSuccess"
    />
  </el-card>
</template>

<script>
  export default {
    data() {
      return {
        formData: {
          location: null
        },
        formDesc: {
          location: {
            label: '地区',
            type: 'tree-select',
            attrs: {
              multiple: true,
              clearable: true,
              searchable: true
            },
            slots: {
              'before-list'(h) {
                return h('div', '这是插槽')
              }
            },
            options: [
              {
                id: 'fruits',
                label: 'Fruits',
                children: [
                  {
                    id: 'apple',
                    label: 'Apple 🍎',
                    isNew: true
                  },
                  {
                    id: 'grapes',
                    label: 'Grapes 🍇'
                  },
                  {
                    id: 'pear',
                    label: 'Pear 🍐'
                  },
                  {
                    id: 'strawberry',
                    label: 'Strawberry 🍓'
                  },
                  {
                    id: 'watermelon',
                    label: 'Watermelon 🍉'
                  }
                ]
              },
              {
                id: 'vegetables',
                label: 'Vegetables',
                children: [
                  {
                    id: 'corn',
                    label: 'Corn 🌽'
                  },
                  {
                    id: 'carrot',
                    label: 'Carrot 🥕'
                  },
                  {
                    id: 'eggplant',
                    label: 'Eggplant 🍆'
                  },
                  {
                    id: 'tomato',
                    label: 'Tomato 🍅'
                  }
                ]
              }
            ]
          }
        }
      }
    },
    methods: {
      handleRequest(data) {
        console.log(data)
        return Promise.resolve()
      },
      handleSuccess() {
        this.$message.success('提交成功')
      }
    },
    mounted() {}
  }
</script>

<style>
  body {
    background-color: #f0f2f5;
  }
</style>

相关链接