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

sk-message-box

v1.0.6

Published

基于**Vue3**的消息弹窗&模态窗的轻量级组件,带TS类型,大小仅不到8kb,分为组件式调用以及指令时调用,可用于一些小型项目,在仅需要弹窗or模态窗操作时可使用该库,方便简洁。

Downloads

56

Readme

sk-message-box

基于Vue3的消息弹窗&模态窗的轻量级组件,带TS类型,大小仅不到8kb,分为组件式调用以及指令时调用,可用于一些小型项目,在仅需要弹窗or模态窗操作时可使用该库,方便简洁。

安装

npm i sk-message-box

使用示例

组件式调用
<script setup lang="ts">
import { ref } from 'vue'
import { SkMessageBox } from 'sk-message-box'

let visible = ref(false)

function onOpen() {
  visible.value = true
}
function onConfirm(close: Function) {
  close()
}
</script>

<template>
  <button @click="onOpen">组件式调用</button>
  <sk-message-box
    title="组件式调用标题"
    closeBtnText="close"
    v-model="visible"
    @confirm="onConfirm"
  >
    <template v-slot:content> 组件式调用内容 </template>
  </sk-message-box>
</template>
指令式调用
<script setup lang="ts">
import { useMessageBox } from './MessageBox/index'

function onOpen() {
  useMessageBox
    .alert({
      title: '提示',
      content: '内容'
    })
    .then(() => {
      console.log('success')
    })
    .catch(() => {
      console.log('catch')
    })
}
</script>

<template>
  <button @click="onOpen">指令式调用</button>
</template>

文档

组件调用文档

| 属性 | 默认值 | 是否必填 | 说明 | | ----------- | ----------- | ----------- | ----------- | | v-model/modelValue | - | 是 | 控制模态窗的显隐 | | title | '标题' | 否 | 模态窗标题 | | content | - | 否 | 模态窗内容, 支持v-slot:content 自行写入内容 | | closeBtnText | '取 消' | 否 | 取消按钮的显示文本 | | confirmBtnText | '确 认' | 否 | 确认按钮的显示文本 | | isShowConfirmBtn | true | 否 | 是否显示确认按钮 | | isShowCloseBtn | true | 否 | 是否显示取消按钮 | | closeOnOther | true | 否 | 是否可通过点击遮罩or关闭图标来关闭弹窗 |

slot

| name | 说明 | | ----------- | ----------- | | content | 模态窗内容插槽 | | footer | 模态窗底部按钮插槽 |

方法

| name | 说明 | 返回值 | | ----------- | ----------- | ----------- | | confirm | 点击确认时触发,该函数的参数中可接受一个close方法,用于关闭弹窗,需要自行手动调用 | void | | close | 关闭时触发 | void |

指令调用文档

| 属性 | 默认值 | 是否必填 | 说明 | | ----------- | ----------- | ----------- | ----------- | | title | '标题' | 否 | 模态窗标题 | | content | - | 否 | 模态窗内容, 支持v-slot:content 自行写入内容 | | closeBtnText | '取 消' | 否 | 取消按钮的显示文本 | | confirmBtnText | '确 认' | 否 | 确认按钮的显示文本 | | isShowConfirmBtn | true | 否 | 是否显示确认按钮 | | isShowCloseBtn | true | 否 | 是否显示取消按钮 | | closeOnOther | true | 否 | 是否可通过点击遮罩or关闭图标来关闭弹窗 |