Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/hj29/vue3-scroll-picker

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/hj29/vue3-scroll-picker

  • v0.1.14
  • Source
  • Go
  • Socket score

Version published
Created
Source

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

NameTypeRequiredDefaultNotes
:optionsstring[][]
{ 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-modelstring[]yes[]Array value emit
Example: [ 'a2', 'b1' ]
active-stylestringno''css (change active option style)style
inactive-stylestringno''css (change inactive option style)style
active-classstringno''css class
inactive-classstringno''css class

Event

NameDescription
@update:modelValueevent emit when use select

Slot

NamepropDescription
v-slot:optionactive: boolean
item: string | { label: string; value: string }
override option card
v-slot:center-overlayoverride center active option area, able to add seperator to active area
v-slot:top-overlayoverride top inactive option area, able to change top gradient color
v-slot:bottom-overlayoverride 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.

FAQs

Package last updated on 23 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc