Socket
Socket
Sign inDemoInstall

@sergtyapkin/modals-popups

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

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
14
increased by55.56%
Maintainers
1
Install size
15.2 kB
Created
Weekly downloads
 

Readme

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

Last updated on 27 Mar 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc