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

vt-message

v2.0.0

Published

message

Downloads

13

Readme

vt-message

vue消息弹窗组件

Use

$ npm install vt-message --save
 import message from 'vt-message'
 
 Vue.component('message', message)

Api

Props

  • title 弹窗标题,默认为空,不展示
  • text 弹窗内容,必传,支持html片段
  • done 按钮点击或濛层点击后响应函数
  • button 确认按钮的文案,支持html片段
  • cancel 取消按钮的文案,支持html片段,传此参数为confirm形式
  • inline 当有两个按钮时,按钮是否在一行展示,如果为true,按钮会变小,一行展示,默认 false
  • show 是否显示弹窗, 默认false

Event

  • done 点击按钮或濛层触发的事件,点击确认按钮参数为(true,'button'),点击取消按钮参数为(false,'button'),点击濛层参数为(false,'mask')

Plugin

使用该组件会默认在Vue实例上注册$message方法,

Arguments

  • title 弹窗标题,默认为空,不展示
  • text 弹窗内容,必传,支持html片段
  • done 按钮点击或濛层点击后响应函数,如果不传,方法执行完返回一个Promise
  • button 确认按钮的文案,支持html片段
  • cancel 取消按钮的文案,支持html片段,传此参数为confirm形式
  • inline 当有两个按钮时,按钮是否在一行展示,如果为true,按钮会变小,一行展示,默认 false
  • tapMaskClose 点击濛层是否触发关闭弹窗, 默认false

Example

1.使用全部参数,返回Promise

Warning:如果传入了cancel参数且未传入done回调函数,将返回一个Promise,此时必须处理Promise的reject情况

this.$message({
      tapMaskClose: true,
      title: '确定操作',
      text: `<p class="color:red">您确定此操作吗?<p>`,
      button: '确认修改',
      cancel:'取消'
    }).then(data=> {
       console.info('确认操作,发送确认操做的Ajax')
    }).catch(err=>{
       console.warn('取消了改操作')
    })

2.使用全部参数,使用回调函数

    this.$message({
          tapMaskClose: true,
          title: '确定操作',
          text: `<p class="color:red">您确定此操作吗?<p>`,
          button: '确认修改',
          cancel:'取消',
          done:(result)=>{
            if(result){
                 console.info('确认操作,发送确认操做的Ajax')
            }else{
                 console.warn('取消了改操作')
            }
          }
        })

3.只显文本

this.$message(`Hello World`)

4.显示title和文本

 this.$message('提示',`Hello World`)