A simple scroll picker plugin for Vue 3

Related tags

vue3-scroll-picker
Overview

vue3-scroll-picker

Vue 3 scroll picker plugin.

Demo

Demo

Demo Code

Install

yarn add vue3-scroll-picker
npm i --save vue3-scroll-picker

Register Global Component

import { createApp } from 'vue';
import App from './App.vue'
import ScrollPicker from 'vue3-scroll-picker';

const app = createApp(App);
app.use(ScrollPicker);
app.mount('#app')

Register Local Component

import ScrollPicker from 'vue3-scroll-picker';

export default {
  components: {
    ScrollPicker,
  },
};

Example

<template>
  <scroll-picker  
    :options="options" 
    v-model="selections"
  />
</template>
<script>
import { defineComponent, reactive, toRefs } from 'vue';
const exampleOptions = [
  [
    {
      label: "A1",
      value: "a1"
    },
    {
      label: "A2",
      value: "a2"
    },
  ],
  [
    {
      label: "B1",
      value: "b1"
    },
    {
      label: "B2",
      value: "b2"
    },
  ],
];
export default defineComponent({
  setup() {
    const state = reactive({
      options: exampleOptions,
      selections: ['a2','b1'],
    });
    return {
      ...toRefs(state),
    };
  }
});
</script>

Props

Name Type Required Default Notes
:options string[][]
{ label: string; value: string }[][]
yes [] Options use can select.
label value type: label as display, value to emit
label value example: [ [ { label: 'A1', value: 'a1' }, { label: 'A2', value: 'a2' } ], [ { label: 'B1', value: 'b1' } ] ]
string type: same label and value
string type example: [ [ 'a1', 'a2' ], [ 'b1' ] ]
:valueModel | v-model string[] yes [] Array value emit
Example: [ 'a2', 'b1' ]
active-style string no '' css (change active option style)style
inactive-style string no '' css (change inactive option style)style
active-class string no '' css class
inactive-class string no '' css class
wheel-speed number no 1 adjust mouse wheel speed with this value.
lower wheel speed, slower scroller

Event

Name Description
@update:modelValue event emit when use select

Slot

Name prop Description
v-slot:option active: boolean
item: string | { label: string; value: string }
override option card
v-slot:center-overlay override center active option area, able to add seperator to active area
v-slot:top-overlay override top inactive option area, able to change top gradient color
v-slot:bottom-overlay override bottom inactive option area, able to change bottom gradient color

Project setup

yarn

Compiles and hot-reloads for development

yarn serve

Compiles and minifies for production

yarn build

Customize configuration

See Configuration Reference.

Issues
  • There is a problem with mouse scrolling

    There is a problem with mouse scrolling

    eg: the select optios : [1,2,3,4,5,6,7,8] ,when the options length > 3, There is no way to transition from 1 to 2 when scrolling the mouse, and always jump 2 steps

    opened by okssq 4
  • style code affect global style

    style code affect global style

    i find that code will affect the global style!

    ::-webkit-scrollbar { width: 0; height: 5px }

    ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .1); border-radius: 10px }

    can you change your code like that? i coun't!! thank you very much!!!

    [your use className]::-webkit-scrollbar { } [your use className]::-w-webkit-scrollbar-thumb{ }

    opened by okssq 2
  • docs: highlight code

    docs: highlight code

    opened by Scrum 0
  • #2 wheel speed

    #2 wheel speed

    handle faster mouse wheel

    opened by HJ29 0
  • problem with android webkit(webview)

    problem with android webkit(webview)

    https://user-images.githubusercontent.com/60599699/121659338-2a3a9e80-cadd-11eb-81c7-ab1a77eb905a.mp4

    it works fine with normal browser and ios webview... but in android it the styling just collapse after a minute of scrolling. any suggestions?

    opened by itsukiuehara 0
  • My advice on sliding.

    My advice on sliding.

    I need to press myfinger on the text to slide. Can i use the sliding interface instead of just the text?

    opened by Aizener 0
A Vue.js directive for body scroll locking without breaking scrolling of a target element.

v-scroll-lock A Vue.js directive for body scroll locking (for iOS Mobile and Tablet, Android, desktop Safari/Chrome/Firefox) without breaking scrollin

Pete Hegman 167 Oct 12, 2021
A simple scroll picker plugin for Vue 3

vue3-scroll-picker Vue 3 scroll picker plugin. Demo Demo Demo Code Install yarn add vue3-scroll-picker npm i --save vue3-scroll-picker Register Global

HJ 13 Sep 10, 2021
Vue3.0 无缝滚动组件

vue3-seamless-scroll Vue3.0 无缝滚动组件 目前组件支持上下左右无缝滚动,单步滚动,并且支持复杂图标的无缝滚动,组件支持原生 css3动画 滚动,目前组件支持平台与Vue3.0支持平台一致。 效果展示 安装 npm npm install vue3-seamless-scr

null 15 Oct 7, 2021
Handy floating scrollbar component for Vue 3

vue-handy-scroll Handy floating scrollbar component for Vue 3. Synopsis vue-handy-scroll is a component that solves the problem of scrolling lengthy c

null 6 Oct 2, 2021
A Vue.js directive for body scroll locking without breaking scrolling of a target element.

v-scroll-lock A Vue.js directive for body scroll locking (for iOS Mobile and Tablet, Android, desktop Safari/Chrome/Firefox) without breaking scrollin

Pete Hegman 169 Oct 14, 2021
Component that customizes the scroll and inserts shadow when scrolling exists

Vue Scroll Shadow • • Component that customizes the scroll and inserts shadow when scrolling exists Installation NPM npm i vue-scroll-shadow # or yarn

André Lins 2 Oct 1, 2021
A super simple Vue component that allows fullscreen and horizontal scroll snapping.

Vue Scroll Snap A super simple Vue component that allows both fullscreen and horizontal scroll snapping. Showcase Check out the live demo to see the s

Angelo 26 Oct 12, 2021
Customize the scrolling position on route navigation. Especially hash mode.

vue-scroll-behavior Customize the scrolling position on route navigation IE / Edge Firefox Chrome Safari Opera iOS Android IE9+, Edge ✓ ✓ ✓ ✓ ✓ ✓ Tabl

Yazhe Wang 136 Jul 13, 2021
A scroll loading component for vue.js.

vue-scroll-loader 简体中文 A scroll loading component for vue.js. View demo Browsers Already use IntersectionObserver polyfill compatible with mainstream

John Wu 57 Sep 30, 2021
🎉 Page scroll progress bar component for @vuejs

vue-scroll-progress ?? Simple Vue.js plugin for page scroll progress bar Live Demo Installation npm i vue-scroll-progress --save yarn add vue-scroll-p

Hyouk Seo 90 Oct 12, 2021
Scrollspy for Vue2

vue2-scrollspy Scrollspy, and animated scroll-to, for Vue2, inspired by vue-scrollspy. See https://ibufu.github.io/vue2-scrollspy/ or Jsfiddle. Instal

morning 130 Sep 1, 2021
A Vue component that syncronize containers scroll positions

vue-scroll-sync A Vue component that syncronize containers scroll positions Installation npm i --save vue-scroll-sync Browser Include the script file,

null 20 Sep 30, 2021
A Vue.js component to top of the page

vue-scroll-up Installation Get from npm / yarn: npm i vue-scroll-up yarn add vue-scroll-up or just include vue-scroll-up.js to your view like <script

Willy Hong 5 Sep 22, 2021
Vue.js plugin for page scroll progress bar

vue-scroll-progress-bar Getting started Install $ npm install @guillaumebriday/vue-scroll-progress-bar --save or $ yarn add @guillaumebriday/vue-scrol

Guillaume Briday 81 Oct 12, 2021
Lightweight package for highlighting menu items as you scroll the page, also scrolling to target section when item clicked. Use as a vue component/directive or in vanilla js.

navscroll-js Installation This package is available on npm. Using npm: npm install --save navscroll Using yarn: yarn add navscroll Directly include it

Honoré Nintunze 52 Aug 12, 2021
Lightweight and simple to use vue component that highlights menu items as you scroll the page, also scrolling to target section when clicked.

vue-scrollactive This component makes it simple to highlight a menu item with an 'active' class as you scroll. Highlights items with a class as you sc

Mauricio Farias Dziedzinski 494 Oct 12, 2021
A tiny Vue directive that stop propagation scroll when edge reached

vue-scroll-stop A tiny Vue directive that stop propagation scroll when edge reached. Works with desktop mousewheel and mobile touchmove events ✅ On ❌

Volodymyr Antoniuk 42 Aug 2, 2021
Vue.js plugin for page scroll progress bar

vue-scroll-progress-bar Getting started Install $ npm install @guillaumebriday/vue-scroll-progress-bar --save or $ yarn add @guillaumebriday/vue-scrol

Guillaume Briday 81 Oct 12, 2021
A vue2 component based on Iscroll

vue-virtual-infinite-scroll a vue2 component based on Iscroll, supports big data list with high performance scroll, infinite load and pull refresh. Ba

Lei Zuo 45 Mar 4, 2021