Skip to content

Commit 51a0337

Browse files
committed
feat(PullDownRefresh): add disabled prop
1 parent c364fc3 commit 51a0337

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

src/pull-down-refresh/props.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { TdPullDownRefreshProps } from './type';
88
import { PropType } from 'vue';
99

1010
export default {
11+
/** 是否禁用下拉刷新 */
12+
disabled: Boolean,
1113
/** 加载中下拉高度,如果值为数字则单位是:'px' */
1214
loadingBarHeight: {
1315
type: [String, Number] as PropType<TdPullDownRefreshProps['loadingBarHeight']>,

src/pull-down-refresh/pull-down-refresh.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
name | type | default | description | required
88
-- | -- | -- | -- | --
9+
disabled | Boolean | false | disabled pull down refresh | N
910
loadingBarHeight | String / Number | 50 | \- | N
1011
loadingProps | Object | - | Typescript:`LoadingProps`[Loading API Documents](./loading?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/pull-down-refresh/type.ts) | N
1112
loadingTexts | Array | [] | Typescript:`string[]` | N

src/pull-down-refresh/pull-down-refresh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
名称 | 类型 | 默认值 | 描述 | 必传
88
-- | -- | -- | -- | --
9+
disabled | Boolean | false | 是否禁用下拉刷新 | N
910
loadingBarHeight | String / Number | 50 | 加载中下拉高度,如果值为数字则单位是:'px' | N
1011
loadingProps | Object | - | 加载loading样式。TS 类型:`LoadingProps`[Loading API Documents](./loading?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/pull-down-refresh/type.ts) | N
1112
loadingTexts | Array | [] | 提示语,组件内部默认值为 ['下拉刷新', '松手刷新', '正在刷新', '刷新完成']。TS 类型:`string[]` | N

src/pull-down-refresh/pull-down-refresh.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default defineComponent({
9292

9393
const onTouchStart = (e: TouchEvent) => {
9494
e.stopPropagation();
95-
if (!isReachTop(e) || loading.value) return;
95+
if (!isReachTop(e) || loading.value || props.disabled) return;
9696

9797
clearTimeout(timer);
9898
timer = null;
@@ -103,7 +103,7 @@ export default defineComponent({
103103

104104
const onTouchMove = (e: TouchEvent) => {
105105
e.stopPropagation();
106-
if (!isReachTop(e) || loading.value) return;
106+
if (!isReachTop(e) || loading.value || props.disabled) return;
107107
touch.move(e);
108108

109109
const { diffY, diffX } = touch;
@@ -135,7 +135,7 @@ export default defineComponent({
135135

136136
const onTouchEnd = (e: TouchEvent) => {
137137
e.stopPropagation();
138-
if (!isReachTop(e) || loading.value) return;
138+
if (!isReachTop(e) || loading.value || props.disabled) return;
139139

140140
if (status.value === 'loosing') {
141141
distance.value = loadingBarHeight.value;

src/pull-down-refresh/type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import { LoadingProps } from '../loading';
88

99
export interface TdPullDownRefreshProps {
10+
/**
11+
* 是否禁用下拉刷新
12+
* @default false
13+
*/
14+
disabled?: boolean;
1015
/**
1116
* 加载中下拉高度,如果值为数字则单位是:'px'
1217
* @default 50

0 commit comments

Comments
 (0)