Skip to content

Commit

Permalink
fix: 修复GuideTour内置中文文案问题 (#1133)
Browse files Browse the repository at this point in the history
Co-authored-by: shijia.sj <[email protected]>
  • Loading branch information
ajiaberry and shijia.sj authored Apr 3, 2024
1 parent 3bb4fb1 commit fab601b
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 13 deletions.
6 changes: 5 additions & 1 deletion compiled/alipay/demo/pages/GuideTour/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
items="{{ list }}"
visible="{{ slotVisible }}"
onCancel="closeTour"
onChange="onChange">
onChange="onChange"
jumpText="跳过"
gotItText="知道了"
prevStepText="上一步"
nextStepText="下一步">
<view
class="step-box"
slot="step"
Expand Down
8 changes: 4 additions & 4 deletions compiled/alipay/src/GuideTour/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@
inline
size="small"
onTap="onCancel">
跳过
{{ jumpText }}
</ant-button>
<ant-button
a:if="{{ utils.checkShowPrev(mixin.value, items) }}"
inline
size="small"
onTap="onPrev"
data-currentValue="{{ mixin.value }}">
上一步
{{ prevStepText }}
</ant-button>
<ant-button
a:if="{{ utils.checkShowNext(mixin.value, items) }}"
inline
size="small"
onTap="onNext"
data-currentValue="{{ mixin.value }}">
下一步
{{ nextStepText }}
</ant-button>
<ant-button
a:if="{{ utils.checkShowKnow(mixin.value, items) }}"
inline
size="small"
onTap="onCancel">
知道了
{{ gotItText }}
</ant-button>
</view>
<block a:if="{{ swiperable }}">
Expand Down
4 changes: 4 additions & 0 deletions compiled/alipay/src/GuideTour/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ toc: 'content'
| `visible` | 是否显示 | `boolean` | `false`|
| `onCancel` | 关闭回调 | `() => void` | - |
| `onChange` | 步骤改变回调 | `(index: number) => void` | - |
| `jumpText` | 跳过按钮的文案 | `string` | '跳过' |
| `prevStepText`| 上一步按钮的文案 | `string` | '上一步' |
| `nextStepText`| 下一步按钮的文案 | `string` | '下一步' |
| `gotItText`| 知道了按钮的文案 | `string` | '知道了' |

### GuideTourItem

Expand Down
24 changes: 24 additions & 0 deletions compiled/alipay/src/GuideTour/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,37 @@ export interface IGuideTour extends IBaseProps {
* @description 步骤改变回调
*/
onChange: (index: number) => boolean;
/**
* @description 上一步按钮文案
* @default "上一步"
*/
prevStepText?: string;
/**
* @description 下一步按钮文案
* @default "下一步"
*/
nextStepText?: string;
/**
* @description 知道了按钮文案
* @default "知道了"
*/
gotItText?: string;
/**
* @description 跳过按钮文案
* @default "跳过"
*/
jumpText?: string;
}

export const GuideTourDefaultProps: Partial<IGuideTour> = {
visible: false,
swiperable: false,
items: [],
defaultCurrent: 0,
gotItText: '知道了',
nextStepText: '下一步',
prevStepText: '上一步',
jumpText: '跳过'
};

export const GuideTourFunctionalProps: Partial<IGuideTour> = {
Expand Down
4 changes: 4 additions & 0 deletions compiled/wechat/src/GuideTour/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ toc: 'content'
| `visible` | 是否显示 | `boolean` | `false`|
| `onCancel` | 关闭回调 | `() => void` | - |
| `onChange` | 步骤改变回调 | `(index: number) => void` | - |
| `jumpText` | 跳过按钮的文案 | `string` | '跳过' |
| `prevStepText`| 上一步按钮的文案 | `string` | '上一步' |
| `nextStepText`| 下一步按钮的文案 | `string` | '下一步' |
| `gotItText`| 知道了按钮的文案 | `string` | '知道了' |

### GuideTourItem

Expand Down
8 changes: 4 additions & 4 deletions compiled/wechat/src/GuideTour/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@
inline
size="small"
bind:tap="onCancel">
跳过
{{ jumpText }}
</ant-button>
<ant-button
wx:if="{{ utils.checkShowPrev(mixin.value, items) }}"
inline
size="small"
bind:tap="onPrev"
data-currentValue="{{ mixin.value }}">
上一步
{{ prevStepText }}
</ant-button>
<ant-button
wx:if="{{ utils.checkShowNext(mixin.value, items) }}"
inline
size="small"
bind:tap="onNext"
data-currentValue="{{ mixin.value }}">
下一步
{{ nextStepText }}
</ant-button>
<ant-button
wx:if="{{ utils.checkShowKnow(mixin.value, items) }}"
inline
size="small"
bind:tap="onCancel">
知道了
{{ gotItText }}
</ant-button>
</view>
<block wx:if="{{ swiperable }}">
Expand Down
4 changes: 4 additions & 0 deletions compiled/wechat/src/GuideTour/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ export var GuideTourDefaultProps = {
swiperable: false,
items: [],
defaultCurrent: 0,
gotItText: '知道了',
nextStepText: '下一步',
prevStepText: '上一步',
jumpText: '跳过'
};
export var GuideTourFunctionalProps = {
maskStyle: '',
Expand Down
4 changes: 4 additions & 0 deletions demo/pages/GuideTour/index.axml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export default ({
visible={slotVisible}
onCancel="closeTour"
onChange="onChange"
jumpText='跳过'
gotItText='知道了'
prevStepText='上一步'
nextStepText='下一步'
>
<View class="step-box" slot="step" slot-scope="props">
step-{props.index}
Expand Down
12 changes: 8 additions & 4 deletions src/GuideTour/index.axml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export default (
items,
visible,
swiperable,
jumpText,
nextStepText,
prevStepText,
gotItText
}: TSXMLProps<IGuideTour>,
{ mixin, current }: InternalData
) => (
Expand All @@ -43,7 +47,7 @@ export default (
<View class="ant-guide-tour-button">
{utils.checkShowJump(mixin.value, items) && (
<AntButton inline size="small" onTap="onCancel">
跳过
{jumpText}
</AntButton>
)}
{utils.checkShowPrev(mixin.value, items) && (
Expand All @@ -53,7 +57,7 @@ export default (
onTap="onPrev"
data-currentValue={mixin.value}
>
上一步
{prevStepText}
</AntButton>
)}
{utils.checkShowNext(mixin.value, items) && (
Expand All @@ -63,12 +67,12 @@ export default (
onTap="onNext"
data-currentValue={mixin.value}
>
下一步
{nextStepText}
</AntButton>
)}
{utils.checkShowKnow(mixin.value, items) && (
<AntButton inline size="small" onTap="onCancel">
知道了
{gotItText}
</AntButton>
)}
</View>
Expand Down
4 changes: 4 additions & 0 deletions src/GuideTour/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ toc: 'content'
| `visible` | 是否显示 | `boolean` | `false`|
| `onCancel` | 关闭回调 | `() => void` | - |
| `onChange` | 步骤改变回调 | `(index: number) => void` | - |
| `jumpText` | 跳过按钮的文案 | `string` | '跳过' |
| `prevStepText`| 上一步按钮的文案 | `string` | '上一步' |
| `nextStepText`| 下一步按钮的文案 | `string` | '下一步' |
| `gotItText`| 知道了按钮的文案 | `string` | '知道了' |

### GuideTourItem

Expand Down
24 changes: 24 additions & 0 deletions src/GuideTour/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,37 @@ export interface IGuideTour extends IBaseProps {
* @description 步骤改变回调
*/
onChange: (index: number) => boolean;
/**
* @description 上一步按钮文案
* @default "上一步"
*/
prevStepText?: string;
/**
* @description 下一步按钮文案
* @default "下一步"
*/
nextStepText?: string;
/**
* @description 知道了按钮文案
* @default "知道了"
*/
gotItText?: string;
/**
* @description 跳过按钮文案
* @default "跳过"
*/
jumpText?: string;
}

export const GuideTourDefaultProps: Partial<IGuideTour> = {
visible: false,
swiperable: false,
items: [],
defaultCurrent: 0,
gotItText: '知道了',
nextStepText: '下一步',
prevStepText: '上一步',
jumpText: '跳过'
};

export const GuideTourFunctionalProps: Partial<IGuideTour> = {
Expand Down

0 comments on commit fab601b

Please sign in to comment.