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

kgddialog

v1.0.5

Published

KGD encapsulates a functional Dialog based on element-plus

Downloads

8

Readme

KGD Dialog

kgddialog 是一个基于 Vue 3 和 Element Plus 封装的函数式Dailog组件,它允许开发者快速集成和使用自定义对话框功能。

Features

  • 易于集成:使用 Vue 3 和 Element Plus,简单的 API 设计。
  • 灵活性:支持所有 Element Plus ElDialog 的属性、插槽和事件。
  • 默认样式:包括默认宽度和标题,可自定义修改。

Installation

yarn add kgddialog

Usage

首先,确保你已经安装并引入了 Element Plus 和 Vue:

yarn add element-plus

如果安装失败,请先删除node_modules文件夹,再次添加包

然后,在你的 Vue 项目中使用 KGDdialog:

import { createApp } from 'vue';
import 'element-plus/dist/index.css';

const app = createApp(App);

app.mount('#app');

How to Use

在你的 Vue 组件中,可以这样使用 kgddialog:

// 示例页面
<template>
  <div>
    <button @click="handleDialog">打开Dialog</button>
  </div>
</template>

<script setup>
import KGDdialog from "kgddialog";
import { h } from "vue";
import { ElTable, ElTableColumn } from "element-plus";
const gridData = [
  { date: "2021-10-01", name: "Tom", address: "No. 123, Sunset Blvd" },
  { date: "2021-10-02", name: "Jerry", address: "No. 456, Sunrise St" },
  { date: "2021-10-03", name: "Mickey", address: "No. 789, Moonlight Ave" },
];

const { openDialog }  = 
  KGDdialog({props: {
      title: "测试 Dialog",
      width: "500px",
      fullscreen: false,
      closeOnPressEscape: true,
      closeOnClickModal: false,
      draggable: true,
    },
    slots: {
      default() {
        return h(
          ElTable,
          { data: gridData },
          {
            default: () => [
              h(ElTableColumn, {
                property: "date",
                label: "Date",
                width: "150",
              }),
              h(ElTableColumn, {
                property: "name",
                label: "Name",
                width: "200",
              }),
              h(ElTableColumn, { property: "address", label: "Address" }),
            ],
          }
        );
      },
      footer() {
        return h("div", "Dialog 底部的内容");
      },
      header() {
        return h("div", "Dialog 标题的内容");
      },
    },
    events: {
      opened() {
        console.log("opened Dialog 已打开");
      },
      close() {
        console.log("close Dialog 已关闭");
      },
    },
  });
 

const handleDialog = () => { openDialog() };
</script>

也支持jsx语法

// 示例页面
<template>
  <div>
    <button @click="handleDialog">打开Dialog</button>
  </div>
</template>

<script setup lang="jsx">
import  KGDdialog from 'kgddialog'

const { openDialog}  = 
  KGDdialog({
    props: {
      title: "测试 Dialog",
      width: "500px",
      fullscreen: false,
      closeOnPressEscape: true,
      closeOnClickModal: false,
      draggable: true,
    },
    slots: {
        default(){
            return <div>Dialog 主体内容12312312</div>
        },
        footer(){
            return <div>Dialog 按钮操作区的内容</div>
        }
    },
    events: {
      open() {
        console.log("open Dialog 打开前");
      },
      opened() {
        console.log("opened Dialog 已打开");
      },
      close() {
        console.log("close Dialog 已关闭");
      },
    },
  });


const handleDialog = () => {openDialog()};
</script>

API

Props

接受所有 Element Plus ElDialog 的属性,例如:

  • title: String —— 对话框标题,默认 "Default Title"
  • width: String —— 对话框宽度,默认 "50%"
  • fullscreen: Boolean —— 是否全屏显示,默认 false

Slots

  • default: 主体内容插槽
  • footer: 底部内容插槽
  • header: 自定义标题插槽

Events

支持所有 Element Plus ElDialog 的事件,例如 open, close 等。

Contributing

欢迎贡献! 如果你想帮助改进这个包,请提交 Pull Requests 或开 Issue 讨论新功能或者变更。

License

发布在 ISC 许可证下。查看 LICENSE 文件了解更多信息。