EASYAIuniappNewUI/node_modules/@tuniao/tnui-vue3-uniapp/components/notify/src/notify.ts
2025-02-08 18:50:38 +08:00

58 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ZIndex } from '../../../constants'
import { buildProps } from '../../../utils'
import type { ExtractPropTypes } from 'vue'
import type { ComponentType } from '../../../constants'
export const notifyShowPosition = ['', 'top', 'center', 'bottom'] as const
export type NotifyShowPosition = (typeof notifyShowPosition)[number]
/**
* @description notify options配置项
*/
export interface NotifyOptions {
/**
* @description 消息内容
*/
msg: string
/**
* @description 消息类型
*/
type?: Omit<ComponentType, ''>
/**
* @description 通知的位置
*/
position?: NotifyShowPosition
/**
* @description 背景颜色
*/
bgColor?: string
/**
* @description 文字颜色
*/
textColor?: string
/**
* @description 自动关闭时间
*/
duration?: number
}
export const notifyProps = buildProps({
/**
* @description 距离顶部的距离防止使用了自定义顶部导航栏后notify 被遮挡,单位为 px
*/
offsetTop: {
type: Number,
default: 0,
},
/**
* @description ZIndex
*/
zIndex: {
type: Number,
default: ZIndex.notify,
},
})
export type NotifyProps = ExtractPropTypes<typeof notifyProps>