# 7.12 轻提示(Toast)
轻提示组件,用于显示简短的提示信息
# 基础用法
<template>
<dof-toast ref="toast" content="操作成功" type="success"></dof-toast>
</template>
<script>
export default {
methods: {
showToast() {
this.$refs.toast.showToast()
},
},
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# Attributes
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
content | String | N | '' | 提示内容 |
type | String | N | '' | 提示图标类型,支持 success、fail |
needDarkMode | Boolean | N | false | 是否启用 M-dark/T-dark 内置暗黑适配 |
backgroundColor | String | N | '' | 背景色 |
textColor | String | N | '' | 文字颜色 |
设置 :need-dark-mode="true" 可启用内置暗黑配色,主题初始化与构建配置见 接入说明。
颜色属性为空时使用内置配色;业务显式颜色和样式覆盖优先于默认配色,关闭暗黑适配后仍有效。
保留深色背景以匹配原白色图片图标,可通过背景和文字颜色属性覆盖。
# Methods
| 方法名 | 说明 | 参数 |
|---|---|---|
showToast | 显示 Toast,组件会在 2 秒后自动隐藏 | - |