GithubHelp home page GithubHelp logo

deta-lee / vue-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from naihe138/vue-picker

0.0 1.0 0.0 329 KB

a picker componemt for vue2.0

Home Page: http://gitblog.naice.me/vue-picker/example/index.html

JavaScript 0.25% Vue 96.58% HTML 3.17%

vue-picker's Introduction

vue-picker

a picker componemt for vue2.0


走了一圈 github 都没有找到自己想要的移动端的 vue-picker的组件,于是自己就下手,撸了一个出来,感受下效果图。 vue-pick.gif

demo

demo 地址:http://gitblog.naice.me/vue-picker/example/index.html

install

npm install vue-pickers --save

使用

<template>
  <div>
    <vue-pickers
      :show="show"
      :columns="columns"
      :defaultData="defaultData"
      :selectData="pickData"
      @cancel="close"
      @confirm="confirmFn"></vue-pickers>
  </div>
</template>

<script>
import vuePickers from 'vue-pickers'
export default {
  components: {
    vuePickers
  },
  data() {
    return {
      show: false,
      columns: 1,
      defaultData: [
        {
          text: 1999,
          value: 1999
        }
      ],
      pickData: {
        // 第一列的数据结构
        data1: [
          {
            text: 1999,
            value: 1999
          },
          {
            text: 2001,
            value: 2001
          }
        ]
      }
    }
  },
  methods: {
    close() {
      this.show = false
    },
    confirmFn(val) {
      this.show = false
      this.defaultData = [val.select1]
    },
    toShow() {
      this.show = true
    }
  }
}
</script>

属性参数说明

参数 说明 是否必须 类型 默认值
show 显示隐藏picker Boolean false
columns 列数设置 Number 1
defaultData 默认显示设置 Array []
link 是否开启联动数据 Boolean false
selectData 数据设置,分别对应列(data1: [], data2: [], data3: [],) Object {}
isRemember 是否每次打开都是初始化的位置高度(设置这个默认值就没有用了) Boolean false

事件说明

参数 说明 是否必须 类型 默认值
cancel 取消选择 function
confirm 确认选择 function(val)

vue-picker's People

Contributors

momopig avatar naihe138 avatar

Watchers

 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.