Skip to content

Commit

Permalink
feat(Guide): new component
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Feb 5, 2024
1 parent 2397027 commit 71e2125
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 62 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
53 changes: 53 additions & 0 deletions packages/products/tdesign-mobile-vue/src/guide/guide.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
:: BASE_DOC ::

## API
### Guide Props

name | type | default | description | required
-- | -- | -- | -- | --
counter | Slot / Function | - | Typescript:`TNode<{ current: number; total: number }>`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
current | Number | - | `v-model` and `v-model:current` is supported | N
defaultCurrent | Number | - | uncontrolled property | N
finishButtonProps | Object | - | Typescript:`ButtonProps` | N
hideCounter | Boolean | false | \- | N
hideSkip | Boolean | false | \- | N
highlightPadding | Number | 8 | \- | N
mode | String | popup | options: popup/dialog | N
nextButtonProps | Object | - | Typescript:`ButtonProps`[Button API Documents](./button?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/guide/type.ts) | N
showOverlay | Boolean | true | \- | N
skipButtonProps | Object | - | Typescript:`ButtonProps` | N
steps | Array | - | Typescript:`Array<GuideStep>` | N
zIndex | Number | 999999 | \- | N
onChange | Function | | Typescript:`(current: number, context?: { e: MouseEvent, total: number }) => void`<br/> | N
onFinish | Function | | Typescript:`(context: { e: MouseEvent, current: number, total: number }) => void`<br/> | N
onNextStepClick | Function | | Typescript:`(context: { e: MouseEvent, next: number, current: number, total: number }) => void`<br/> | N
onSkip | Function | | Typescript:`(context: { e: MouseEvent, current: number, total: number }) => void`<br/> | N

### Guide Events

name | params | description
-- | -- | --
change | `(current: number, context?: { e: MouseEvent, total: number })` | \-
finish | `(context: { e: MouseEvent, current: number, total: number })` | \-
next-step-click | `(context: { e: MouseEvent, next: number, current: number, total: number })` | \-
skip | `(context: { e: MouseEvent, current: number, total: number })` | \-

### GuideStep

name | type | default | description | required
-- | -- | -- | -- | --
body | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
content | Slot / Function | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
element | String / Function | - | required。Typescript:`AttachNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | Y
highlightContent | Slot / Function | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
highlightPadding | Number | - | \- | N
mode | String | - | options: popup/dialog | N
nextButtonProps | Object | - | Typescript:`ButtonProps` | N
offset | Array | - | this api is in discussing. do not use it.。Typescript:`Array<string \| number>` | N
placement | String | 'top' | Typescript:`StepPopupPlacement \| StepDialogPlacement` `type StepPopupPlacement = 'top'\|'left'\|'right'\|'bottom'\|'top-left'\|'top-right'\|'bottom-left'\|'bottom-right'\|'left-top'\|'left-bottom'\|'right-top'\|'right-bottom'` `type StepDialogPlacement = 'top'\|'center' `[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/guide/type.ts) | N
popupProps | Object | - | Popup component props if `mode = popup`。Typescript:`PopupProps`[Popup API Documents](./popup?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/guide/type.ts) | N
prevButtonProps | Object | - | Typescript:`ButtonProps` | N
showOverlay | Boolean | true | \- | N
skipButtonProps | Object | - | Typescript:`ButtonProps` | N
stepOverlayClass | String | - | \- | N
title | String | - | \- | N
53 changes: 53 additions & 0 deletions packages/products/tdesign-mobile-vue/src/guide/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
:: BASE_DOC ::

## API
### Guide Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
counter | Slot / Function | - | 用于自定义渲染计数部分。TS 类型:`TNode<{ current: number; total: number }>`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
current | Number | - | 当前步骤,即整个引导的进度。-1 则不展示,用于需要中断展示的场景。支持语法糖 `v-model``v-model:current` | N
defaultCurrent | Number | - | 当前步骤,即整个引导的进度。-1 则不展示,用于需要中断展示的场景。非受控属性 | N
finishButtonProps | Object | - | 透传 完成 的全部属性,示例:`{ content: '完成', theme: 'primary' }`。TS 类型:`ButtonProps` | N
hideCounter | Boolean | false | 是否隐藏计数 | N
hideSkip | Boolean | false | 是否隐藏跳过按钮 | N
highlightPadding | Number | 8 | 高亮框的内边距 | N
mode | String | popup | 引导框的类型。可选项:popup/dialog | N
nextButtonProps | Object | - | 透传 下一步按钮 的全部属性,示例:{ content: '下一步', theme: 'primary' }。TS 类型:`ButtonProps`[Button API Documents](./button?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/guide/type.ts) | N
showOverlay | Boolean | true | 是否出现遮罩层 | N
skipButtonProps | Object | - | 透传 跳过按钮 的全部属性,{ content: '跳过', theme: 'default' }。TS 类型:`ButtonProps` | N
steps | Array | - | 用于定义每个步骤的内容,包括高亮的节点、相对位置和具体的文案内容等。。TS 类型:`Array<GuideStep>` | N
zIndex | Number | 999999 | 提示框的层级 | N
onChange | Function | | TS 类型:`(current: number, context?: { e: MouseEvent, total: number }) => void`<br/>当前步骤发生变化时触发 | N
onFinish | Function | | TS 类型:`(context: { e: MouseEvent, current: number, total: number }) => void`<br/>点击完成按钮时触发 | N
onNextStepClick | Function | | TS 类型:`(context: { e: MouseEvent, next: number, current: number, total: number }) => void`<br/>点击下一步时触发 | N
onSkip | Function | | TS 类型:`(context: { e: MouseEvent, current: number, total: number }) => void`<br/>点击跳过按钮时触发 | N

### Guide Events

名称 | 参数 | 描述
-- | -- | --
change | `(current: number, context?: { e: MouseEvent, total: number })` | 当前步骤发生变化时触发
finish | `(context: { e: MouseEvent, current: number, total: number })` | 点击完成按钮时触发
next-step-click | `(context: { e: MouseEvent, next: number, current: number, total: number })` | 点击下一步时触发
skip | `(context: { e: MouseEvent, current: number, total: number })` | 点击跳过按钮时触发

### GuideStep

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
body | String / Slot / Function | - | 当前步骤提示框的内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
content | Slot / Function | - | 用户自定义引导弹框的内容,一旦存在,此时除 `placement``offset``element` 外,其它属性全部失效)。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
element | String / Function | - | 必需。高亮的节点。数据类型为 String 时,会被当作选择器处理,进行节点查询。示例:'#tdesign' 或 () => document.querySelector('#tdesign')。TS 类型:`AttachNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | Y
highlightContent | Slot / Function | - | 用户自定义的高亮框 (仅当 `mode``popup` 时生效)。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
highlightPadding | Number | - | 高亮框的内边距 | N
mode | String | - | 引导框的类型。可选项:popup/dialog | N
nextButtonProps | Object | - | 用于自定义当前引导框的下一步按钮的内容。TS 类型:`ButtonProps` | N
offset | Array | - | 【讨论确认中】相对于 placement 的偏移量,示例:[-10, 20]['10px', '8px']。TS 类型:`Array<string \| number>` | N
placement | String | 'top' | 引导框相对于高亮元素出现的位置。TS 类型:`StepPopupPlacement \| StepDialogPlacement` `type StepPopupPlacement = 'top'\|'left'\|'right'\|'bottom'\|'top-left'\|'top-right'\|'bottom-left'\|'bottom-right'\|'left-top'\|'left-bottom'\|'right-top'\|'right-bottom'` `type StepDialogPlacement = 'top'\|'center' `[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/guide/type.ts) | N
popupProps | Object | - | 透传全部属性到 Popup 组件。`mode=popup` 时有效。TS 类型:`PopupProps`[Popup API Documents](./popup?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/guide/type.ts) | N
prevButtonProps | Object | - | 用于自定义当前引导框的上一步按钮的内容。TS 类型:`ButtonProps` | N
showOverlay | Boolean | true | 是否出现遮罩层 | N
skipButtonProps | Object | - | 用于自定义当前步骤引导框的跳过按钮的内容。TS 类型:`ButtonProps` | N
stepOverlayClass | String | - | 覆盖引导框的类名 | N
title | String | - | 当前步骤的标题内容 | N
Loading

0 comments on commit 71e2125

Please sign in to comment.