AdaptiveToast

AdaptiveToast

自适应的toast
处理原生toast截断问题,详见[疑难杂症] toast截断问题

Constructor

new AdaptiveToast(optionsopt)

Source:

构造函数

Parameters:
Name Type Attributes Description
options object <optional>

配置参数

Properties
Name Type Attributes Default Description
icons Object.<string, string> <optional>
{success: '/images/toast/success.png',fail: '/images/toast/fail.png'}

图标映射表,key为调用方指定的toast场景类型,value为对应的图标路径

defaultOpts AdaptiveToast~ToastOptions <optional>
{title: '',type: 'fail',duration: 2000}

toast的默认选项

Methods

(async) sysToastIcon(options)

Source:

文案较少时使用的toast,带图标,最多只能展示7个汉字

Parameters:
Name Type Description
options AdaptiveToast~ToastOptions

toast参数

(async) sysToastModal(options)

Source:

文案巨长时使用的toast,自动改用系统弹窗

Parameters:
Name Type Description
options AdaptiveToast~ToastOptions

toast参数

(async) sysToastText(options)

Source:

文案中等长度时使用的toast,不带图标,最多展示两行

Parameters:
Name Type Description
options AdaptiveToast~ToastOptions

toast参数

(async) toast(options)

Source:

自适应的toast,会自动根据文案长度选择合适的提示方式

Parameters:
Name Type Description
options AdaptiveToast~ToastOptions

toast参数

Type Definitions

ToastOptions

Source:
Properties:
Name Type Attributes Description
title string

toast文案

type string <optional>

toast场景类型

duration number <optional>

toast时长,单位:ms

toast参数

Type:
  • object