Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(message): support single props #550

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ align | String | left | options: left/center。Typescript:`MessageAlignType` `
closeBtn | String / Boolean / Slot / Function | undefined | Typescript:`string \| boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
content | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
duration | Number | 3000 | \- | N
gap | String / Number / Boolean | 12 | \- | N
icon | Boolean / Slot / Function | true | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
link | String / Object / Slot / Function | - | Typescript:`string \| object \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
marquee | Boolean / Object | false | Typescript:`boolean \| MessageMarquee` `interface MessageMarquee { speed?: number; loop?: number; delay?: number }`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/message/type.ts) | N
offset | Array | - | Typescript:`Array<string \| number>` | N
single | Boolean | true | \- | N
theme | String | info | options: info/success/warning/error。Typescript:`MessageThemeList` `type MessageThemeList = 'info' \| 'success' \| 'warning' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/message/type.ts) | N
visible | Boolean | false | `v-model` and `v-model:visible` is supported | N
defaultVisible | Boolean | false | uncontrolled property | N
Expand Down
2 changes: 2 additions & 0 deletions packages/products/tdesign-mobile-vue/src/message/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ align | String | left | 文本对齐方式。可选项:left/center。TS 类型
closeBtn | String / Boolean / Slot / Function | undefined | 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。也可以完全自定义按钮。TS 类型:`string \| boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
content | String / Slot / Function | - | 用于自定义消息弹出内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
duration | Number | 3000 | 消息内置计时器,计时到达时会触发 duration-end 事件。单位:毫秒。值为 0 则表示没有计时器 | N
gap | String / Number / Boolean | 12 | 两条 `message` 之间的间距 | N
icon | Boolean / Slot / Function | true | 用于自定义消息前面的图标,优先级大于 theme 设定的图标。值为 false 则不显示图标,值为 true 显示 theme 设定图标。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
link | String / Object / Slot / Function | - | 链接名称。值为字符串表示链接名称,值为 `Object` 类型,表示透传至 `Link`。TS 类型:`string \| object \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
marquee | Boolean / Object | false | 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放。TS 类型:`boolean \| MessageMarquee` `interface MessageMarquee { speed?: number; loop?: number; delay?: number }`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/message/type.ts) | N
offset | Array | - | 相对于 placement 的偏移量,示例:[-10, 20] 或 ['10rpx', '8rpx']。TS 类型:`Array<string \| number>` | N
single | Boolean | true | 是否保持仅显示一条信息 | N
theme | String | info | 消息组件风格。可选项:info/success/warning/error。TS 类型:`MessageThemeList` `type MessageThemeList = 'info' \| 'success' \| 'warning' \| 'error'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/message/type.ts) | N
visible | Boolean | false | 是否显示,隐藏时默认销毁组件。支持语法糖 `v-model` 或 `v-model:visible` | N
defaultVisible | Boolean | false | 是否显示,隐藏时默认销毁组件。非受控属性 | N
Expand Down
10 changes: 10 additions & 0 deletions packages/products/tdesign-mobile-vue/src/message/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export default {
type: Number,
default: 3000,
},
/** 两条 `message` 之间的间距 */
gap: {
type: [String, Number, Boolean] as PropType<TdMessageProps['gap']>,
default: 12,
},
/** 用于自定义消息前面的图标,优先级大于 theme 设定的图标。值为 false 则不显示图标,值为 true 显示 theme 设定图标 */
icon: {
type: [Boolean, Function] as PropType<TdMessageProps['icon']>,
Expand All @@ -49,6 +54,11 @@ export default {
offset: {
type: Array as PropType<TdMessageProps['offset']>,
},
/** 是否保持仅显示一条信息 */
single: {
type: Boolean,
default: true,
},
/** 消息组件风格 */
theme: {
type: String as PropType<TdMessageProps['theme']>,
Expand Down
10 changes: 10 additions & 0 deletions packages/products/tdesign-mobile-vue/src/message/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export interface TdMessageProps {
* @default 3000
*/
duration?: number;
/**
* 两条 `message` 之间的间距
* @default 12
*/
gap?: string | number | boolean;
/**
* 用于自定义消息前面的图标,优先级大于 theme 设定的图标。值为 false 则不显示图标,值为 true 显示 theme 设定图标
* @default true
Expand All @@ -43,6 +48,11 @@ export interface TdMessageProps {
* 相对于 placement 的偏移量,示例:[-10, 20] 或 ['10rpx', '8rpx']
*/
offset?: Array<string | number>;
/**
* 是否保持仅显示一条信息
* @default true
*/
single?: boolean;
/**
* 消息组件风格
* @default info
Expand Down
4 changes: 4 additions & 0 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -73961,6 +73961,7 @@
{
"id": 1725334222,
"platform_framework": [
"8",
"64"
],
"component": "Message",
Expand Down Expand Up @@ -73991,6 +73992,7 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)",
"Miniprogram"
],
"field_type_text": [
Expand Down Expand Up @@ -74264,6 +74266,7 @@
{
"id": 1725334169,
"platform_framework": [
"8",
"64"
],
"component": "Message",
Expand Down Expand Up @@ -74292,6 +74295,7 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)",
"Miniprogram"
],
"field_type_text": [
Expand Down