Giter VIP home page Giter VIP logo

uni-app-missthee-indexlist's Introduction

uni-app 索引列表

一个简单的带索引列表。支持情况比较尴尬:

  • 移动端h5普通模式、大数据模式均支持。
  • 微信小程序仅普通模式支持。(因为大数据有dom操作,所以不支持小程序使用。。)
  • APP和其他不清楚。。因为还没做过app和其他。。

使用

    <template>
      <missthee-indexlist :listData="listData" :isBigData='enableBigData' @select-item='selectHandler'></missthee-indexlist>
    </template>
    
    <script>
      export default {
        data() {
          return {
    		enableBigData: true, //是否开启大数据渲染,如果开启会插入20000条测试数据到表格,方法在create中
            listData: {
              "A": [{
                id: 1,  //[必须]id,作为v-for的key使用
                name: "A市",  //[必须]名称,作为显示字段
    			customParam: "自定义属性" //可以额外添加任意的自定义属性,返回结果中会包含这些属性
              },],
              "B": [{
                id: 2,
                name: "B市",
              },
              {
                id: 3,
                name: "B1市",
              },],
              "C": [{
                id: 4,
                name: "C市",
              },],
              "D": [{
                id: 5,
                name: "D市",
              },],
              "E": [{
                id: 6,
                name: "E市",
              },],
              "F": [{
                id: 7,
                name: "F市",
              },],
              "G": [{
                id: 8,
                name: "G市",
              },],
              "H": [{
                id: 9,
                name: "淮北市",
              },],
              "I": [{
                id: 10,
                name: "淮北市",
              },],
              "J": [{
                id: 11,
                name: "J市",
              },],
              "K": [{
                id: 12,
                name: "K市",
              },],
              "L": [{
                id: 13,
                name: "L市",
              },],
              "M": [{
                id: 14,
                name: "M市",
              },],
              "N": [{
                id: 15,
                name: "N市",
              },],
              "O": [{
                id: 16,
                name: "O市",
              },],
              "P": [{
                id: 17,
                name: "P市",
              },],
              "Q": [{
                id: 18,
                name: "Q市",
              },],
              "R": [{
                id: 19,
                name: "R市",
              },],
              "S": [{
                id: 20,
                name: "S市",
              },],
              "T": [{
                id: 21,
                name: "T市",
              },],
              "U": [{
                id: 22,
                name: "U市",
              },],
              "V": [{
                id: 23,
                name: "V市",
              },],
              "W": [{
                id: 24,
                name: "W市",
              },],
              "X": [{
                id: 25,
                name: "X市",
              },],
              "Y": [{
                id: 26,
                name: "Y市",
              },],
              "Z": [{
                id: 27,
                name: "Z市",
              },],
              "#": [{
                id: 28,
                name: "123市",
              },{
                id: 29,
                name: "456市",
              },],
            }
          }
        },
        created() {
          if(this.enableBigData){ // 开启大数据插入20000条测试数据
            for (let i = 0; i < 20000; i++) {
              this.listData.A.push({
                id: 1000 + i,
                name: "A市" + i,
              })
            }
          }
        },
        methods: {
          selectHandler(e) {
            console.log('选中城市', e) // 返回选中对象 {id: 1, name: "A市", customParam: "自定义属性"}
          }
        }
      }
    </script>

属性

属性 默认值 说明
data {} 绑定列表数据
placeholder 输入关键字查询 顶部查询框placeholder
useIndex true 启用右侧索引(默认启用,关闭需设置:useIndex='false')
isBigData false 启动表格大数据动态渲染(默认不启用,打开需设置isBigData或:isBigData='true')
事件 说明
select-item 点击列表内容触发,返回选中的对象

uni-app-missthee-indexlist's People

Contributors

missthee avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.