vue-dragscroll is a lightweight Vue.js directive designed to enable scrolling of an HTML element via a drag-and-drop or click-and-hold mouse interaction. The current stable version, 4.0.6, is specifically built for Vue 3 projects and leverages modern tooling such as TypeScript and Vite. This package offers a simple, declarative way to implement interactive scrolling without needing complex configurations, distinguishing itself as a focused directive rather than a comprehensive scrolling utility. It provides an intuitive user experience for horizontally or vertically scrollable containers. Release cadence has historically been tied to major Vue version compatibility, with key updates like adding Vue 3 support and migrating to a TypeScript codebase.
npm install vue-dragscrollVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to globally register the `dragscroll` directive and apply it to a scrollable `div` in a Vue 3 application. It creates a simple horizontal scroll container populated with items that can be scrolled by dragging with the mouse.
Upgrade to Vue 3 or pin `vue-dragscroll` to a version compatible with Vue 2 (e.g., <3.0.0).
Ensure your project is running Vue 3 when using `vue-dragscroll` v3.x or v4.x. For Vue 2 projects, use `vue-dragscroll` versions <3.0.0.
Always use ES module import syntax (`import { dragscroll } from 'vue-dragscroll';`) when consuming the package in Vue 3 projects.Ensure you have globally registered the directive using `app.directive('dragscroll', dragscroll);` after importing `dragscroll`.Use the correct ES module named import: `import { dragscroll } from 'vue-dragscroll';`.Run `npm install vue-dragscroll` or `yarn add vue-dragscroll` to install the package. Double-check the import statement for typos.