An open API service indexing awesome lists of open source software.

https://github.com/rameel/vue-pagelock

A simple utility for managing page scroll locking within Vue applications. No external dependencies.
https://github.com/rameel/vue-pagelock

page-locking pagelock scroll-lock scroll-locking

Last synced: 11 months ago
JSON representation

A simple utility for managing page scroll locking within Vue applications. No external dependencies.

Awesome Lists containing this project

README

          

# Vue-Pagelock

The `@ramstack/vue-pagelock` represents a simple utility for managing page scroll locking within Vue applications. The library weights less than 1KB, and 500 bytes when gzipped.

Uses [@ramstack/pagelock](https://github.com/rameel/pagelock) under the hood.

## Installation

### Using via NPM
```sh
npm install --save @ramstack/vue-pagelock
```

### using via CDN
```html

const app = Vue.createApp({
setup() {
}
});

// Register the pagelock plugin
app.use(PagelockPlugin);

app.mount("#app");

```

### Using the ES module build
```html

import { createApp } from "https://unpkg.com/vue@3/dist/vue.esm-browser.js";
import { PagelockPlugin } from "https://cdn.jsdelivr.net/npm/@ramstack/vue-pagelock@1/dist/vue-pagelock.esm.min.js";

const app = createApp({
setup() {
}
});

// Register the pagelock plugin
app.use(PagelockPlugin);

app.mount("#app");

```

## Usage examples

After installation, register the plugin at the application-wide level.

```js
import App from "./App";
import { createApp } from "vue";
import { PagelockPlugin } from "@ramstack/vue-pagelock";

const app = createApp(App);
app.use(PagelockPlugin);
app.mount("#app");
```

Or directly import the directive into the desired components.

```vue

Show modal

import { ref } from "vue";
import { vPagelock } from "@ramstack/vue-pagelock";

const isOpen = ref(false);

function show(): void {
isOpen.value = true;
};

function hide(): void {
isOpen.value = false;
};

```

## License
This package is released under the **MIT License**.