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

vue-toast-plugin-mobile

v0.0.8

Published

vue component

Downloads

5

Readme

vue-toast-plugin-mobile

vue 移动端组件 toast

Installation

npm install vue-toast-plugin-mobile
//or
yarn add vue-toast-plugin-mobile

Usage

// main.js
import Vue from 'vue'
import 'vue-toast-plugin-mobile/lib/index.css' // 在入口js引入css

// Home.vue
import Toast from 'vue-toast-plugin-mobile'
export default {
  mounted() {
    Toast.show('这是一个持续1.5S的toast')

    setTimeout(() => {
      Toast.show({
        message: '这是一个持续4S的toast',
        duration: 4000
      })
    }, 3000)

    Toast.close() // 关闭

    setTimeout(() => {
      Toast.success('操作成功')

      // 下面的写法也是同样的效果
      // Toast.show({
      //   message: '操作成功',
      //   type: 'success'
      // })
    }, 7000)

    setTimeout(() => {
      Toast.loading('加载中') // type = loading 时 必须调用 Toast.close() 方法关闭, deration 参数失效
    }, 10000)
  }
}

若需在文字上方显示一个 icon 图标,可以将图标的类名作为 iconClass 的值传给 Toast(图标需自行准备)

// iconClass 会覆盖type类型的内置icon
Toast.show({
  message: '操作成功',
  iconClass: 'icon icon-success'
})

API

| 参数 | 说明 | 类型 | 可选值 | 默认值 | | --------- | ------------------------------------------- | ------- | --------------------------------------- | -------- | | message | 需要展示的内容 | string | | | | position | Toast 的位置 | string | top , bottom , middle | middle | | type | 内置的 toast 类型 | string | success , fail , loading , info | | | duration | 持续时间(毫秒),若为 -1 则不会自动关闭 () | number | | 1500 | | mask | 是否显示遮罩层 | boolean | | false | | className | Toast 的类名。可以为其添加样式 | String | | | | iconClass | icon 图标的类名 | String | | |

注: duration = -1 或者 type = 'loading' 时,duration 无效,toast 不会消失;隐藏 toast 需要手动调用 close

全局销毁方法: Toast.close()