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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hz_yujin/vue-dialog

v0.1.4

Published

Vue 3 ProDialog:基于 Element Plus Dialog 全量透传,附带默认 footer / 异步确认 / 尺寸预设

Readme

@hz_yujin/vue-dialog

基于 Vue 3 + Element Plus Dialog 的弹框封装。

  • ProDialog — 全量透传 ElDialog 的 props / events / slots / expose
  • 可选默认 footer(确认 / 取消)、异步确认、尺寸预设、全局 defaults
  • 多级嵌套:子弹框写在父级插槽内自动识别,默认 append-to-body

安装

npm install @hz_yujin/vue-dialog element-plus vue

element-plusvuepeerDependencies,需由宿主项目安装。

使用

import { createApp } from 'vue'
import { ProDialog } from '@hz_yujin/vue-dialog'
import '@hz_yujin/vue-dialog/style.css'

// 或全局注册
import VueDialog from '@hz_yujin/vue-dialog'
app.use(VueDialog)
<script setup lang="ts">
import { ref } from 'vue'
import { ProDialog } from '@hz_yujin/vue-dialog'
import '@hz_yujin/vue-dialog/style.css'

const visible = ref(false)

async function onConfirm() {
  await new Promise((r) => setTimeout(r, 800))
  // 返回 false 可阻止关闭
}
</script>

<template>
  <el-button type="primary" @click="visible = true">打开</el-button>

  <ProDialog
    v-model="visible"
    title="编辑"
    size="md"
    show-footer
    destroy-on-close
    @confirm="onConfirm"
  >
    <p>弹框内容</p>
  </ProDialog>
</template>

尺寸预设

| size | width | |------|-------| | sm | 420px | | md | 520px | | lg | 720px | | xl | 920px |

显式传入 width 时优先生效。

多级弹框

把子 ProDialog 写在父级默认插槽内,会自动识别嵌套并默认开启 append-to-body

<ProDialog v-model="l1" title="一级" size="lg">
  <el-button @click="l2 = true">打开二级</el-button>

  <ProDialog v-model="l2" title="二级" size="md">
    <el-button @click="l3 = true">打开三级</el-button>
    <ProDialog v-model="l3" title="三级" size="sm" />
  </ProDialog>
</ProDialog>

也可显式标记:nested(强制按嵌套处理)。业务组件内可用:

import { useProDialogNest } from '@hz_yujin/vue-dialog'

const nest = useProDialogNest() // { level, close } | null

全局默认

import { setDialogDefaults } from '@hz_yujin/vue-dialog'

setDialogDefaults({
  size: 'md',
  alignCenter: true,
  destroyOnClose: true,
  confirmText: '保存',
})

透传能力

与 Element Plus Dialog 对齐,包括但不限于:

  • props:title / width / fullscreen / draggable(默认 false) / overflow / align-center / before-close / append-to / destroy-on-close / header-class
  • events:open / opened / close / closed / open-auto-focus / close-auto-focus
  • slots:default / header / footer / title(兼容)
  • expose:visible / level / isNested / dialogContentRef / resetPosition / handleClose

开发

在 monorepo 根目录:

pnpm install
pnpm dev
pnpm build:dialog