Skip to content
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

Merged
merged 6 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name | type | default | description | required
-- | -- | -- | -- | --
closeBtn | Boolean / Slot / Function | true | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
deleteBtn | Boolean / Slot / Function | false | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
images | Array | [] | Typescript:`Array<string>` | N
images | Array | [] | Typescript:`Array<string\|{url: string;align: 'start' \| 'center' \| 'end';}>` | N
index | Number | - | `v-model:index` is supported | N
defaultIndex | Number | - | uncontrolled property | N
maxZoom | Number | 3 | Typescript:`Number` | N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- | -- | -- | -- | --
closeBtn | Boolean / Slot / Function | true | 是否展示关闭按钮,值为 `true` 显示默认关闭按钮;值为 `false` 则不显示关闭按钮;也可以完全自定义关闭按钮。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
deleteBtn | Boolean / Slot / Function | false | 是否显示删除操作,前提需要开启页码。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
images | Array | [] | 图片数组。TS 类型:`Array<string>` | N
images | Array | [] | 图片数组。TS 类型:`Array<string\|{url: string;align: 'start' \| 'center' \| 'end';}>` | N
index | Number | - | 当前预览图片所在的下标。支持语法糖 `v-model:index` | N
defaultIndex | Number | - | 当前预览图片所在的下标。非受控属性 | N
maxZoom | Number | 3 | 【开发中】最大放大比例。TS 类型:`Number` | N
Expand Down
59 changes: 59 additions & 0 deletions packages/products/tdesign-mobile-vue/src/image-viewer/props.ts
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 packages/products/tdesign-mobile-vue/src/image-viewer/type.ts
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;
}
12 changes: 3 additions & 9 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -60342,10 +60342,7 @@
{
"id": 2601,
"platform_framework": [
"8",
"16",
"32",
"64"
"8"
],
"component": "ImageViewer",
"field_category": 1,
Expand All @@ -60362,7 +60359,7 @@
"create_time": "2022-04-18 13:55:45",
"update_time": "2022-05-30 13:26:12",
"event_output": null,
"custom_field_type": "Array<string>",
"custom_field_type": "Array<string|{url: string;align: 'start' | 'center' | 'end';}>",
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
Expand All @@ -60373,10 +60370,7 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)",
"Miniprogram"
liweijie0812 marked this conversation as resolved.
Show resolved Hide resolved
"Vue(Mobile)"
],
"field_type_text": [
"Array"
Expand Down
Loading