Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
fix: 修复uni-indexed-list选项选中事件参数定义错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulyssesyi committed Mar 4, 2024
1 parent 6fe50cb commit 4afbf43
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/uni-indexed-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@ interface _UniIndexedListOption {
/** 索引 */
data: string[];
}
/** 数据对象 */
interface _UniIndexedItemSelected {
/** 索引标题 */
key: string;
/** 索引 */
name: string;
/** 索引序号 */
itemIndex: number;
/** 索引是否选中 */
checked: boolean;
}

interface _UniIndexedListOnClickEvent {
item: _UniIndexedListOption;
select: _UniIndexedListOption[];
item: _UniIndexedItemSelected;
select: _UniIndexedItemSelected[];
}

/** 点击触发 */
Expand Down Expand Up @@ -44,6 +55,7 @@ type _UniIndexedListInstance = InstanceType<_UniIndexedList>;

export {
_UniIndexedListOption as UniIndexedListOption,
_UniIndexedItemSelected as UniIndexedItemSelected,
_UniIndexedListOnClickEvent as UniIndexedListOnClickEvent,
_UniIndexedListOnClick as UniIndexedListOnClick,
_UniIndexedListProps as UniIndexedListProps,
Expand All @@ -55,6 +67,7 @@ declare global {
namespace UniHelper {
/** 数据对象 */
export interface UniIndexedListOption extends _UniIndexedListOption {}
export interface UniIndexedItemSelected extends _UniIndexedItemSelected {}
export type UniIndexedListOnClickEvent = _UniIndexedListOnClickEvent;
/** 点击触发 */
export interface UniIndexedListOnClick extends _UniIndexedListOnClick {}
Expand Down
4 changes: 4 additions & 0 deletions tests/uni-indexed-list.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expectTypeOf } from 'vitest';
import type {
UniIndexedListOption,
UniIndexedItemSelected,
UniIndexedListOnClickEvent,
UniIndexedListOnClick,
UniIndexedListProps,
Expand All @@ -12,6 +13,9 @@ describe('UniIndexedList', () => {
expectTypeOf<UniIndexedListOption>().toBeObject();
expectTypeOf<UniIndexedListOption>().toEqualTypeOf<UniHelper.UniIndexedListOption>();

expectTypeOf<UniIndexedItemSelected>().toBeObject();
expectTypeOf<UniIndexedItemSelected>().toEqualTypeOf<UniHelper.UniIndexedItemSelected>();

expectTypeOf<UniIndexedListOnClickEvent>().toBeObject();
expectTypeOf<UniIndexedListOnClickEvent>().toEqualTypeOf<UniHelper.UniIndexedListOnClickEvent>();

Expand Down

0 comments on commit 4afbf43

Please sign in to comment.