1.0.5 • Published 7 years ago

wx-tips v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Tips 微信原生tips封装

安装

npm install wx-tips  # npm安装方式
yarn add wx-tips  # yarn安装方式

使用指南

// utils/tips.js
import tips from 'wx-tips'

export default const instance = tips.getInstance({
    errorIconPath: '/images/error.png', // 错误提示图片路径  必须提供
    alertIconPath: '/images/alert.png', // alert提示图片路径 必须提供
    loadingMode: 'Loading' // 选项 NavigationBarLoading|Loading
})
// app.js
import tips '/utils/tips'

tips.alert('alert')
tips.modal('modal')
tips.loading()
tips.loaded()

tips getInstance方法参数配置

参数说明类型默认值必须
errorIconPath错误提示图片路径 绝对路径String''true
alertIconPathalert提示图片路径 绝对路径String''true
loadingModeloading模式 Loading对应 wx.showLoading/wx.hideLoading NavigationBarLoading对应 wx.showNavigationBarLoading/wx.hideNavigationBarLoadingStringNavigationBarLoadingfalse
duration显示周期,毫秒int1000false

tips 实例方法api

    static getInstance(config = {}) this
    success(title, duration = '') Promise
    modal(content = '', title = '') Promise
    confirm(content, payload = {}, title) Promise
    toast(title, hideCallback, icon = 'success', duration = '')
    loading(title = '', force = false)
    loaded()
    alert(title, duration = '') Promise
    error(title, hideCallback, duration = '')
    setLoading()
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago