Socket
Socket
Sign inDemoInstall

@sergtyapkin/modals-popups

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sergtyapkin/modals-popups

![Static Badge](https://img.shields.io/badge/Vue.js-components-green) ![npm](https://img.shields.io/npm/dt/%40sergtyapkin%2Fmodals-popups)


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Modals and Popups Vue.js components

Static Badge npm

Modals and popups components for your Vue.js app


Usage: In your entrypoint .vue component (may be App.vue):


<template>
  <!-- Router component -->

  <Popups ref="popups"></Popups>
  <Modals ref="modals"></Modals>
</template>

<script>
  import {getCurrentInstance} from "vue";
  import {Modals, Popups} from "@sergtyapkin/modals-popups";

  export default {
    components: {Modals, Popups},

    mounted() {
      const global = getCurrentInstance().appContext.config.globalProperties;

      global.$modals = this.$refs.modals;
      global.$popups = this.$refs.popups;
      global.$app = this;
    },
  };
</script>

Now you can use in any child components:

this.$modals.alert(title, description='');
this.$modals.prompt(title, description='', defaultText='');
this.$modals.confirm(title, description='');
// Returns:
// 'modals.alert' -> null (window closed) / true ('OK' pressed)
// 'modals.prompt' -> null (window closed) / 'some text' ('OK' pressed)
// 'modals.confirm' -> null (window closed) / false ('No' pressed) / true ('Yes' pressed)

this.$popups.error(title, description='', timeToDisappear=3000);
this.$popups.alert(title, description='', timeToDisappear=3000);
this.$popups.success(title, description='', timeToDisappear=3000);
// Returns undefined

FAQs

Package last updated on 28 Jan 2024

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