-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
10,909 additions
and
7,721 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# PullRefresh | ||
|
||
## 基础用法 | ||
|
||
:::demo pull-refresh/base | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<CdxPullRefresh | ||
v-model="loading" | ||
@refresh="handleRefresh" | ||
style="height: 400px" | ||
> | ||
<p v-for="i in 20">{{ i }}</p> | ||
</CdxPullRefresh> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue'; | ||
const loading = ref(false); | ||
const handleRefresh = () => { | ||
console.log('refresh'); | ||
setTimeout(() => { | ||
loading.value = false; | ||
}, 3000); | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,60 @@ | ||
import { buildProps, definePropType } from '@cdx-component/utils'; | ||
import type { ExtractPropTypes } from 'vue'; | ||
|
||
export type CheckStatusInfo = { | ||
success: boolean; | ||
message: string; | ||
}; | ||
export enum CheckStatus { | ||
success = 'success', | ||
fail = 'fail', | ||
none = 'none', | ||
} | ||
export enum CaptchType { | ||
slider = 'slider', | ||
pointer = 'pointer', | ||
} | ||
export const captchaProps = buildProps({ | ||
type: { | ||
type: String, | ||
values: ['slider', 'pointer'], | ||
default: CaptchType.slider, | ||
}, | ||
image: { | ||
type: String, | ||
required: true, | ||
}, | ||
canvasSize: { | ||
type: definePropType<[number, number]>(Array), | ||
default: () => [500, 300], | ||
}, | ||
texts: { | ||
type: definePropType<string[]>(Array), | ||
validator: (v: any) => | ||
Array.isArray(v) && v.every((item: any) => typeof item === 'string' && item.length === 1), | ||
}, | ||
fontRate: { | ||
type: Number, | ||
default: 0.108, | ||
validator: (v: any) => typeof v === 'number' && v >= 0 && v <= 1, | ||
}, | ||
onBeforSuccess: { | ||
type: definePropType<() => Promise<boolean | CheckStatusInfo> | boolean | CheckStatusInfo>(Function), | ||
}, | ||
loading: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
onRefresh: { | ||
type: definePropType<() => void | Promise<void>>(Function), | ||
}, | ||
tipDuration: { | ||
type: Number, | ||
default: 3000, | ||
}, | ||
} as const); | ||
export type CaptchaProps = ExtractPropTypes<typeof captchaProps>; | ||
|
||
export const captchaEmits = { | ||
success: () => true, | ||
fail: () => true, | ||
imgError: () => true, | ||
}; | ||
export type CaptchaEmits = typeof captchaEmits; | ||
import { buildProps, definePropType } from '@cdx-component/utils'; | ||
import type { ExtractPropTypes } from 'vue'; | ||
|
||
export type CheckStatusInfo = { | ||
success: boolean; | ||
message: string; | ||
}; | ||
export enum CheckStatus { | ||
success = 'success', | ||
fail = 'fail', | ||
none = 'none', | ||
} | ||
|
||
export const captchaProps = buildProps({ | ||
type: { | ||
type: String, | ||
values: ['slider', 'pointer'], | ||
default: 'slider', | ||
}, | ||
image: { | ||
type: String, | ||
required: true, | ||
}, | ||
canvasSize: { | ||
type: definePropType<[number, number]>(Array), | ||
default: () => [500, 300], | ||
}, | ||
texts: { | ||
type: definePropType<string[]>(Array), | ||
validator: (v: any) => | ||
Array.isArray(v) && v.every((item: any) => typeof item === 'string' && item.length === 1), | ||
}, | ||
fontRate: { | ||
type: Number, | ||
default: 0.108, | ||
validator: (v: any) => typeof v === 'number' && v >= 0 && v <= 1, | ||
}, | ||
onBeforSuccess: { | ||
type: definePropType<() => Promise<boolean | CheckStatusInfo> | boolean | CheckStatusInfo>(Function), | ||
}, | ||
loading: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
onRefresh: { | ||
type: definePropType<() => void | Promise<void>>(Function), | ||
}, | ||
tipDuration: { | ||
type: Number, | ||
default: 3000, | ||
}, | ||
} as const); | ||
export type CaptchaProps = ExtractPropTypes<typeof captchaProps>; | ||
|
||
export const captchaEmits = { | ||
success: () => true, | ||
fail: () => true, | ||
imgError: () => true, | ||
}; | ||
export type CaptchaEmits = typeof captchaEmits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { withInstall } from '@cdx-component/utils'; | ||
import PullRefresh from './src/pull-refresh.vue'; | ||
|
||
export const CdxPullRefresh = withInstall(PullRefresh); | ||
export * from './src/pull-refresh'; | ||
export default CdxPullRefresh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { UPDATE_MODEL_EVENT } from '@cdx-component/constants'; | ||
import { buildProps, isBoolean } from '@cdx-component/utils'; | ||
import type { ExtractPropTypes } from 'vue'; | ||
|
||
export enum PullRefreshStatus { | ||
pulling = 'pulling', | ||
loading = 'loading', | ||
loosing = 'loosing', | ||
none = 'none', | ||
} | ||
|
||
export const pullRefreshProps = buildProps({ | ||
modelValue: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
disabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
headHeight: { | ||
type: [Number, String], | ||
default: 50, | ||
}, | ||
refreshDistance: { | ||
type: [Number, String], | ||
}, | ||
} as const); | ||
export type PullRefreshProps = ExtractPropTypes<typeof pullRefreshProps>; | ||
|
||
export const pullRefreshEmits = { | ||
[UPDATE_MODEL_EVENT]: (value: boolean) => isBoolean(value), | ||
refresh: () => true, | ||
}; | ||
export type PullRefreshEmits = typeof pullRefreshEmits; |
Oops, something went wrong.