Skip to content

useToast ​

提示

存文字提示,不带 icon 提示,默认居中显示

兼容性 ​

NvueVueH5微信小程序支付宝小程序百度小程序字节小程序QQ 小程序
未测☑☑未测未测未测未测未测

引入 ​

js
import useToast from "@/hook/useToast";

方法 / API ​

基础使用 ​

js
useToast("提示")
useToast("提示",3000)

Options ​

参数名说明必填类型默认值备注
option显示内容☑String
duration显示时间Number2500时间单位 ms

高级使用 ​

js
useToast({
  title: "内容"
  position: "bottom"
  duration: 3000
  success: () => {
    console.log("success")
  }
  fail:() => {
    console.log("fail")
  }
  complete: () => {
    console.log("complete")
  }
})

Options ​

参数名说明必填类型默认值备注
title显示内容☑String
position显示位置Stringcenter有效值详见下方,仅 App 生效
duration显示时间Number2500时间单位 ms
success成功回调Function
fail失败回调Function
complete结束回调Function
position 值说明 ​
值说明
top居上显示
center居中显示
bottom居底显示

说明 / Notes ​

  • 暂无

常见问题 / FAQ ​

来源 / Source ​

源码 • 文档 • 示例

贡献者 / Contributors ​

日志 / Changelog ​

No recent changes