Giter Site home page Giter Site logo

js-mark / vue-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yzq1993/vue-picker

1.0 1.0 0.0 50 KB

基于vue2的移动端picker组件,提供了日期选择,时间选择 ,省市区选择,多级联动

HTML 1.35% Vue 43.43% JavaScript 55.22%

vue-picker's Introduction

vue-picker

基于vue2的移动端picker组件,提供了日期选择,时间选择 ,省市区选择,多级联动

demo


import vuePicker from 'vue-picker'
Vue.use(vuePicker)
//也可以单独引入
import {picker,datepicker,citypicker,multipicker} from 'vue-picker'
Vue.prototype.$picker = picker
Vue.prototype.$datepicker = datepicker
Vue.prototype.$citypicker = citypicker
Vue.prototype.$multipicker = multipicker

this.$picker({
  value:1//默认值
  title:'请选择数字',//默认为'请选择'
  option:[1,2,3,4,5]//选择项,也可以多重选择 [[1,2,3,4],[1,2,3,4,5,6]],多重选择时,默认值为数组
  change:(value)=>{
    console.log(value)//值改变时调用
 }
}).then((value)=>{
  console.log(value)
})

this.$datepicker({
  value:[2015,10,28],
  title:'请选择',
  type:'date'//date选择日期,time选择时间,datetime选择日期+时间,year选择年份,yearmonth选择年月,默认为date
  endYear:2020,//结束的年份,默认为今年
  startYear:1950,//开始的年份,默认为1900
  change:(value)=>{
    console.log(value)
  }
}).then((value)=>{})

this.$citypicker({
  value:['浙江','杭州','西湖区'],
  title:'请选择省市区',
  type:3,//1选择省,2选择省市,3选择省市区,默认为3
  change:(value)=>{
    console.log(value)
  }
}).then((value)=>{})

this.$multipicker({
  value:[],
  title:'请选择',
  option:[
    {name:1,children:[{name:'1-1'},{name:'1-2'},{name:'1-3'}]},
    {name:2,children:[{name:'2-1'},{name:'2-2'},{name:'2-3'}]},
    {name:3}
  ],//可以多级嵌套
  change:(value)=>{
    console.log(value)
  }
}).then((value)=>{})

vue-picker's People

Contributors

newcomein avatar yzq1993 avatar

Stargazers

 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.