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

@fastweb/modal

v2.0.2

Published

模态框

Downloads

19

Readme

弹框模态框 Build Status npm


模态框,支持jq插件用法,全局用法,支持promise

安装

esm:

cnpm i @fastweb/modal -S

common:

cnpm i @fastweb/modal_common -S

##用法

import {Modal,ModalInstance,ModalJQuery} from '@fastweb/modal';
//普通用法
new Modal(options);
//全局方法
ModalInstance.alert('***');
ModalInstance.confirm('***');
ModalInstance.toast('***');
ModalInstance.prompt('***');
//使用jq
ModalJQuery($);
$.alert('***');
$.confirm('***');
$.toast('***');
$.prompt('***');
$("domId").modal(options|"show"|"hide")

options

  • backdrop: 默认true(true有遮罩且可以点击,false无遮罩,static有遮罩不可点击)
  • show: 默认false(默认显示)
  • time: 默认0(自动关闭的时间,为0不自动关闭)
  • type: 默认'defalut' (success,warning,info,danger)
  • width: null (宽)
  • height: null (高)
  • container: 默认document.body (弹框容器)
  • location: 默认'center' (弹框位置center,bottom,top)
  • content: null (弹框内容)
  • title: null (弹框标题)
  • icon: 'logo' (图标ok,error,warning,img.src)
  • btn: null (按钮 eg: {"确定":function(){...},"取消":function(){...}})
  • mold: ''//alert,confirm,toast
  • value:''(prompt的value)
  • animation: ['fadeIn', 'fadeOut'] (location为center,bottom,top下默认值分别为['fadeIn', 'fadeOut'],['slideInUp', 'slideOutDown'],['slideInDown', 'slideOutUp'])

方法

  • show 显示
  • hide 隐藏

destroy 摧毁

事件

  • onInit 初始化
  • onShow 显示
  • onClickBtn 点击按钮
  • onHide 隐藏

onDestroy 摧毁

jq参数

  • options 同上options
  • show 显示
  • hide 隐藏

全局参数

  • alert(msg, title, cb)
  • confirm(msg, title, sucCb, errCb)
  • prompt(msg,value, title, sucCb, errCb)
  • toast(msg, time默认1000)

注:

  • msg,value必填,其他可选eg:confirm(msg, cb)
  • sucCb, errCb回调可以使用promise代替eg:
  confirm("你确定吗").then(()=>{
    console.log("确定")
  }).catch(()=>{
    console.log("取消")
  })