Skip to content

vue组件,列表选择,滑动回弹,滑动纠偏,仿IOS选择列表,H5页面插件

Notifications You must be signed in to change notification settings

aol121/list-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

使用教程

组件暴露:

   props:{
   	dataList:[...],//需要渲染的列表
   	liheight: {
   	  default: 44
   	}
   }
   method:selectedchange //自定义方法,传选中值给父组件
   	

组件内有部分注释,小伙伴可根据业务需求自行修改, 实际业务中列表数据应该是包含多个对象的数组, demo中只渲染了字符串数组

	<li v-for="(item,i) in data" :style="{height:liheight+'px',lineHeight:liheight+'px'}" 
          :class="{'current-pre3':(index-3)===i || (index+3)===i,
            'current-pre2':(index-2)===i || (index+2)===i,
            'current-pre1':(index-1)===i || (index+1)===i,
            'current':index===i}">{{item}}</li>
	

大家根据业务场景自行修改所需显示的内容

在父组件中引入

	//template
	<div class="picker-box">
		
        <picker :dataList="list" liheight="50" @selectedchange="fn"></picker>
    </div>
	//js
	import picker from '../pick.vue' //引入
	export default {
		components: {
		  picker,
		},
		data(){
			list:[...]
		},
		methods:{
			fn(value){
				console.log(value);//获得选中值
			}
		}
		
	
	}
		

样式: 预览图

附带原生js版本

About

vue组件,列表选择,滑动回弹,滑动纠偏,仿IOS选择列表,H5页面插件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published