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-simple-confirm

v1.0.5

Published

Simple popup component for Vue 3

Downloads

3

Readme

Vue Simple Confirm

Preview

vue-simple-confirm-preview

Install

pnpm install --save vue-simple-confirm

Quick Start

In main.ts or main.js

import { createApp } from 'vue'
import App from './App.vue'
import VueSimpleConfirm from 'vue-simple-confirm'
import 'vue-simple-confirm/dist/index.css'

const app = createApp(App)

app
  .use(VueSimpleConfirm)
  .mount('#app')

In App.vue (or any SFC you want to add it)

Use setup script

<script setup lang="ts">
import { inject } from 'vue'
import { confirm } from 'vue-simple-confirm'

const $confirm = inject(confirm)!

const showPopup = () => $confirm({
  title: 'Title',
  mount: '#second',
  message: 'string',
  button: {
    yes:'Good',
  },
  okCallback() {
    alert('Ok')
  }
})
</script>
<template>
  <button @click="showPopup">
    Show
  </button>
  <div id="second"></div>
  <vue-simple-confirm />
</template>

Use Option API

<template>
  <button @click="showPopup">
    Show
  </button>
  <vue-simple-confirm />
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { confirm } from 'vue-simple-confirm'

export default defineComponent({
  inject: {
    confirm: { from: confirm },
  },
  methods: {
    showPopup() {
      this.confirm({
        title: 'Title',
        message: 'string',
        button: {
          yes:'Good',
        },
        okCallback() {
          alert('Ok')
        }
      })
    }
  }
})
</script>

You also can put component in App.vue and inject confirm function in anywhere you want to use.

Configuration

You can config your dialog theme in here, we provide ios and material design, default is ios.

app.use(VueSimpleConfirm, {
  // options configuration
  theme: 'ios'
})

If you want to use your custom design, you can add your theme name and add theme to css file like below.

app.use(VueSimpleConfirm, {
  // options configuration
  theme: 'custom'
})

You can use css or scss to design your theme

.sd-layer.custom {
  background-color: rgba(225, 225, 225, 0.4); 
}

.sd-layer.custom .sd-container {
  border: 1px solid #000;
}

.sd-layer.custom .sd-body {
  text-align: center;
}
.sd-layer.custom .sd-body h3 {
  border-bottom: 1px solid #000;
  margin: 0;
  padding: 0.5rem;
}
.sd-layer.custom .sd-text {
  padding: 0.5rem;
}
.sd-layer.custom .sd-btn {
  width: 50%;
  border: 0;
  background-color: transparent;
}
.sd-layer.custom .sd-btn:hover {
  background-color: #000;
  color: #fff;
  transition: 0.5s all;
}

.sd-layer.custom .sd-btn:first-child {
  border-right: 1px solid #000;
}
.sd-layer.custom .sd-footer {
  display: flex;
  min-height: 2rem;
  border-top: 1px solid #000;
}

|Name|Type|Require|Default| |:---:|:---:|:---:|:---:| |theme|ios / material|optional|ios| |layoutClose|boolean|optional|false|

API

|Name|Type|Require|Default| |:---:|:---:|:---:|:---:| |title|string|optional|''| |message|string|required|''| |button.yes|string|optional|ok| |button.no|string|optional|cancel| |mount|string|optional|''| |callback|(confirm: boolean) => void|optional|null|