2.0.6-beta.1 • Published 4 months ago

@coleqiu/vue-drag-select v2.0.6-beta.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

🔧Installation

npm i @coleqiu/vue-drag-select
yarn add @coleqiu/vue-drag-select

📘Demo

Storybook

Edit vue-drag-select-example

🧭Quick Guide

⚙Import

import { createApp } from "vue";
import VueDragSelect from "@coleqiu/vue-drag-select";

const app = createApp(App);
app.use(VueDragSelect);

🚀Usage

<script setup lang="ts">
import { ref } from 'vue';

const selection = ref([]);
const options = [ "item1", "item2", "item3" ];
</script>

<template>
  <drag-select v-model="selection">
    <drag-select-option v-for="item in options" :value="item" :key="item">{{item}}</drag-select-option>
  </drag-select>
</template>

<style>
.drag-select-option {
  width: 100px;
  height: 100px;
  color: #ffffff;
  background: #E37E26;
}

.drag-select-option--selected {
  color: #000000;
  background: #5fdddc;
}
</style>

📖Ducumentation

DragSelect Attributes

AttributeDescriptionTypeDefault
modelValue / v-modelbinding valueArray | Set<string | number>--(required)
backgroundbackground color of drag area, 'none' represent hide this style to avoid override background color of classstringrgba(66, 153, 225, 0.5
draggableOnOptioncan draggable when dragstart event target on DragSelectOptionbooleantrue
clickOptionToSelectwhether to enable the click item selection functionbooleantrue
clickBlankToClearwhether to enable clicking on blank content to clear the optionbooleantrue
dragAreaClassthe class names of drag areastring--
dragAreaStylethe class styles of drag areastring--
selectedOptionClassthe class names of selected DragSelectOptionstring--
selectedOptionStylethe selected styles of selected DragSelectOptionstring--
multiplewhether to keep the previously selectedboolean--
activeMultipleKeysafter pressing a certain key, multiple mode will be activated'meta' | 'shift' | 'ctrl' | 'alt''meta' | 'ctrl' | 'shift'
deselectRepeatedin multiple mode, deselect options that are repeatedly selectedboolean--
<!-- disabledwhether DragSelect is disabledbooleanfalse -->

DragSelectOption Attributes

AttributeDescriptionTypeDefault
valuebinding valuestring | index--(required)
disabledwhether DragSelectOption is disabledbooleanfalse
selectedClassthe class names of selected optionboolean--

Component classNames

this package havn't enough styles,you can use following classNames to add styles. name | Description -|- drag-selectwrapper | the className of DragSelect itself drag-select | the className of the container of dragSelectOption drag-selectarea | the className of drag area drag-select-option | the className of dragSelectOption component drag-select-option--selected | the className of dragSelectOption component which are selected drag-select-option--disabled | the className of dragSelectOption component which are disabled

2.0.6-beta.1

4 months ago

2.0.5

10 months ago

2.0.4

10 months ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.1-rc1

4 years ago

1.0.0

4 years ago

0.0.1

4 years ago