npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-responsive-components-mixin

v1.2.1

Published

A Vue mixin for making components responsive to window size changes.

Downloads

3

Readme

Vue Responsive Mixin

Vue Responsive Mixin is a simple, lightweight Vue.js mixin designed to help you easily manage and react to changes in window size within your Vue components. This mixin automatically updates component data with the current window width and height upon initialization and when the browser window is resized, leveraging lodash's debounce function to optimize performance.

Features

  • Automatically tracks and updates window width and height.
  • Debounced window resize event listener to minimize performance impact.
  • Easy to integrate with any Vue.js project.
  • Leverages lodash's debounce for efficient event handling.

Installation

To use the Vue Responsive Mixin, you need to ensure Vue and lodash.debounce are installed in your project. If they are not installed, you can add them by running:

npm install vue lodash.debounce --save

Usage

To use this mixin, simply import it into your Vue component or globally register it to make it available across all components in your Vue application.

Importing into a Single Component

import Vue from 'vue';
import responsiveMixin from './path/to/vue-responsive-mixin';

export default {
  mixins: [responsiveMixin],
// Your component's options...
};

Global Registration

import Vue from 'vue';
import responsiveMixin from './path/to/vue-responsive-mixin';

Vue.mixin(responsiveMixin);

After importing and registering the mixin, the windowWidth and windowHeight data properties will automatically be available in your Vue component and will update whenever the window is resized.

Example

Here's a simple example of how you might use the windowWidth and windowHeight data properties in a component:


<template>
    <div>
        <p>Window width: {{ windowWidth }}px</p>
        <p>Window height: {{ windowHeight }}px</p>
    </div>
</template>

<script>
    import responsiveMixin from './path/to/vue-responsive-mixin';

    export default {
        mixins: [responsiveMixin]
    };
</script>

Contributing

Contributions to Vue Responsive Mixin are welcome! Feel free to submit issues or pull requests on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.