useToast
提示
存文字提示,不带 icon 提示,默认居中显示
兼容性
| Nvue | Vue | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ 小程序 |
|---|---|---|---|---|---|---|---|
| 未测 | ☑ | ☑ | 未测 | 未测 | 未测 | 未测 | 未测 |
引入
js
import useToast from "@/hook/useToast";方法 / API
基础使用
js
useToast("提示")
useToast("提示",3000)Options
| 参数名 | 说明 | 必填 | 类型 | 默认值 | 备注 |
|---|---|---|---|---|---|
| option | 显示内容 | ☑ | String | ||
| duration | 显示时间 | Number | 2500 | 时间单位 ms |
高级使用
js
useToast({
title: "内容"
position: "bottom"
duration: 3000
success: () => {
console.log("success")
}
fail:() => {
console.log("fail")
}
complete: () => {
console.log("complete")
}
})Options
| 参数名 | 说明 | 必填 | 类型 | 默认值 | 备注 |
|---|---|---|---|---|---|
| title | 显示内容 | ☑ | String | ||
| position | 显示位置 | String | center | 有效值详见下方,仅 App 生效 | |
| duration | 显示时间 | Number | 2500 | 时间单位 ms | |
| success | 成功回调 | Function | |||
| fail | 失败回调 | Function | |||
| complete | 结束回调 | Function |
position 值说明
| 值 | 说明 |
|---|---|
| top | 居上显示 |
| center | 居中显示 |
| bottom | 居底显示 |
说明 / Notes
- 暂无
常见问题 / FAQ
来源 / Source
贡献者 / Contributors
日志 / Changelog
No recent changes