-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(tdesign-mobile-vue/image-viewer): 更新image-viewer api #291
Open
aaronmhl
wants to merge
2
commits into
TDesignOteam:main
Choose a base branch
from
aaronmhl:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+168
−4
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
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
59 changes: 59 additions & 0 deletions
59
packages/products/tdesign-mobile-vue/src/image-viewer/props.ts
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,59 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TdImageViewerProps } from './type'; | ||
import { PropType } from 'vue'; | ||
|
||
export default { | ||
/** 是否展示关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 则不显示关闭按钮;也可以完全自定义关闭按钮 */ | ||
closeBtn: { | ||
type: [Boolean, Function] as PropType<TdImageViewerProps['closeBtn']>, | ||
default: true, | ||
}, | ||
/** 是否显示删除操作,前提需要开启页码 */ | ||
deleteBtn: { | ||
type: [Boolean, Function] as PropType<TdImageViewerProps['deleteBtn']>, | ||
default: false, | ||
}, | ||
/** 图片数组 */ | ||
images: { | ||
type: Array as PropType<TdImageViewerProps['images']>, | ||
default: (): TdImageViewerProps['images'] => [], | ||
}, | ||
/** 当前预览图片所在的下标 */ | ||
index: { | ||
type: Number, | ||
default: undefined, | ||
}, | ||
/** 当前预览图片所在的下标,非受控属性 */ | ||
defaultIndex: { | ||
type: Number, | ||
}, | ||
/** 【开发中】最大放大比例 */ | ||
maxZoom: { | ||
type: Number, | ||
default: 3, | ||
}, | ||
/** 是否显示页码 */ | ||
showIndex: Boolean, | ||
/** 隐藏/显示预览 */ | ||
visible: { | ||
type: Boolean, | ||
default: undefined, | ||
}, | ||
modelValue: { | ||
type: Boolean, | ||
default: undefined, | ||
}, | ||
/** 隐藏/显示预览,非受控属性 */ | ||
defaultVisible: Boolean, | ||
/** 关闭时触发 */ | ||
onClose: Function as PropType<TdImageViewerProps['onClose']>, | ||
/** 点击删除操作按钮时触发 */ | ||
onDelete: Function as PropType<TdImageViewerProps['onDelete']>, | ||
/** 预览图片切换时触发,`context.prev` 切换到上一张图片,`context.next` 切换到下一张图片 */ | ||
onIndexChange: Function as PropType<TdImageViewerProps['onIndexChange']>, | ||
}; |
70 changes: 70 additions & 0 deletions
70
packages/products/tdesign-mobile-vue/src/image-viewer/type.ts
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,70 @@ | ||
/* eslint-disable */ | ||
|
||
/** | ||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC | ||
* */ | ||
|
||
import { TNode } from '../common'; | ||
|
||
export interface TdImageViewerProps { | ||
/** | ||
* 是否展示关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 则不显示关闭按钮;也可以完全自定义关闭按钮 | ||
* @default true | ||
*/ | ||
closeBtn?: boolean | TNode; | ||
/** | ||
* 是否显示删除操作,前提需要开启页码 | ||
* @default false | ||
*/ | ||
deleteBtn?: boolean | TNode; | ||
/** | ||
* 图片数组 | ||
* @default [] | ||
*/ | ||
images?: Array<string | { url: string; align: 'start' | 'center' | 'end' }>; | ||
/** | ||
* 当前预览图片所在的下标 | ||
*/ | ||
index?: number; | ||
/** | ||
* 当前预览图片所在的下标,非受控属性 | ||
*/ | ||
defaultIndex?: number; | ||
/** | ||
* 【开发中】最大放大比例 | ||
* @default 3 | ||
*/ | ||
maxZoom?: Number; | ||
/** | ||
* 是否显示页码 | ||
* @default false | ||
*/ | ||
showIndex?: boolean; | ||
/** | ||
* 隐藏/显示预览 | ||
* @default false | ||
*/ | ||
visible?: boolean; | ||
/** | ||
* 隐藏/显示预览,非受控属性 | ||
* @default false | ||
*/ | ||
defaultVisible?: boolean; | ||
/** | ||
* 隐藏/显示预览 | ||
* @default false | ||
*/ | ||
modelValue?: boolean; | ||
/** | ||
* 关闭时触发 | ||
*/ | ||
onClose?: (context: { trigger: 'overlay' | 'close-btn'; visible: Boolean; index: Number }) => void; | ||
/** | ||
* 点击删除操作按钮时触发 | ||
*/ | ||
onDelete?: (index: Number) => void; | ||
/** | ||
* 预览图片切换时触发,`context.prev` 切换到上一张图片,`context.next` 切换到下一张图片 | ||
*/ | ||
onIndexChange?: (index: number, context: { trigger: 'prev' | 'next' }) => void; | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不可以移除其他框架平台
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @anlyyao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修复处理
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miniprogram和mobile的api定义是要保持一致的,不用单独再定义mobile-vue的,如果Miniprogram不需要此api定义,再抽出来单独定义Miniprogram的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mobile vue 端 ImageViewer 要先支持图片懒加载等功能,weijie 结合对应的 issues 和 pr 来看哇~
Tencent/tdesign-mobile-vue#1411
Tencent/tdesign-mobile-vue#1422