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

@springleo/el-dialog-helper

v0.1.5

Published

## Install

Downloads

5

Readme

el-dialog-helper

Install

yarn add @springleo/el-dialog-helper

Online Example

https://lq782655835.github.io/el-dialog-helper

Quick Start

Import modules and set up settings in main.js:

import ElDialogHelper from '@springleo/el-dialog-helper'
Vue.use(ElDialogHelper)

use Vue.prototype.$openDialog in your App.vue

<template>
  <el-button type="primary" @click="open" size="small">编程式打开dialog</el-button>
</template>

<script>
import ElementUIDialog from "./elementui-dialog";
export default {
  methods: {
    open() {
      this.$openDialog(ElementUIDialog)({ name: "123" })
        .then(() => this.$message.success('任务成功'))
        .catch(() => this.$message.warning('任务失败'));
    }
  }
};
</script>

use Vue.prototype.$closeDialog in your elementui-dialog.vue:

<template>
  <el-dialog title="ElementUI Dialog" :visible.sync="visible">
    {{ name }}
    <div>
      <el-button type="primary" @click="$closeDialog(true)">确定</el-button>
      <el-button @click="$closeDialog(false)">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: { name: String },
  data() {
    return { visible: false };
  }
};
</script>

API

1. Vue.prototype.$openDialog()

使用方式:this.$openDialog(DialogComponent)(props = {}, parentContext = undefined)

  • DialogComponent: 自定义的弹窗.vue组件

  • props:弹窗组件需要传入的初始化props

  • parentContext:弹窗的父级上下文,一般用于获取父级 provider, 如获取 ConfigProvider 的配置、$store、$router

返回等待用户弹窗关闭的Promise,当Dialog弹窗组件$emit('done')时,resolve promise;当$emit('cancel')时,reject promise。

2. Vue.prototype.$closeDialog()

使用方式: this.$closeDialog(isSuccess = false, ...args)

全局注入的快捷方法,是$emit('done')和$emit('cancel')的快捷键。当isSuccess = true,执行$emit('done');当isSuccess = false时,执行$emit('cancel')。

Vue plugin series

| Plugin | Status | Description | | :---------------- | :-- | :-- | | @springleo/el-dialog-helper | | Promisify dialogs in Vue! | | @springleo/el-table-plus | | 基于el-table的配置化组件| | @springleo/el-form-plus | | schema form base on element-ui form |

License

MIT