Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion packages/components/search/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ clearable | Boolean | true | \- | N
confirm-hold | Boolean | false | \- | N
confirm-type | String | search | options: send/search/next/go/done | N
cursor | Number | -1 | required | Y
cursor-color | String | #0052d9 | `1.12.1` | N
cursor-spacing | Number | 0 | \- | N
disabled | Boolean | false | \- | N
focus | Boolean | false | \- | N
Expand All @@ -28,7 +29,7 @@ placeholder | String | '' | \- | N
placeholder-class | String | input-placeholder | \- | N
placeholder-style | String | - | required | Y
readonly | Boolean | undefined | \- | N
result-list | Array | [] | Typescript`Array<string>` | N
result-list | Array | [] | Typescript: `Array<string>` | N
right-icon | String | 'close-circle-filled' | `deprecated` | N
selection-end | Number | -1 | \- | N
selection-start | Number | -1 | \- | N
Expand Down
1 change: 1 addition & 0 deletions packages/components/search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ clearable | Boolean | true | 是否启用清除控件 | N
confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起 | N
confirm-type | String | search | 设置键盘右下角按钮的文字,仅在type='text'时生效。<br />具体释义:<br />`send` 右下角按钮为“发送”;<br />`search` 右下角按钮为“搜索”;<br />`next` 右下角按钮为“下一个”;<br />`go` 右下角按钮为“前往”;<br />`done` 右下角按钮为“完成”。<br />[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html)。可选项:send/search/next/go/done | N
cursor | Number | -1 | 必需。指定 focus 时的光标位置 | Y
cursor-color | String | #0052d9 | `1.12.1`。光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制 | N
cursor-spacing | Number | 0 | 搜索框聚焦时底部与键盘的距离 | N
disabled | Boolean | false | 是否禁用 | N
focus | Boolean | false | 是否聚焦 | N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ exports[`search Props :base 1`] = `
confirmHold="{{false}}"
confirmType="search"
cursor="{{-1}}"
cursorColor="#0052d9"
cursorSpacing="{{0}}"
disabled="{{null}}"
focus="{{false}}"
Expand Down
2 changes: 1 addition & 1 deletion packages/components/search/__test__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ describe('search', () => {
comp.attach(document.createElement('parent-wrapper'));

const $clear = comp.querySelector('.search >>> .t-search__clear');
$clear.dispatchEvent('tap');
$clear.dispatchEvent('touchstart');
await simulate.sleep(20);
expect(onClear).toHaveBeenCalledTimes(1);
expect(val).toBe('');
Expand Down
5 changes: 5 additions & 0 deletions packages/components/search/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ const props: TdSearchProps = {
value: -1,
required: true,
},
/** 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制 */
cursorColor: {
type: String,
value: '#0052d9',
},
/** 搜索框聚焦时底部与键盘的距离 */
cursorSpacing: {
type: Number,
Expand Down
3 changes: 2 additions & 1 deletion packages/components/search/search.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
selection-end="{{selectionEnd}}"
hold-keyboard="{{holdKeyboard}}"
cursor-spacing="{{cursorSpacing}}"
cursor-color="{{cursorColor}}"
placeholder="{{placeholder}}"
placeholder-style="{{placeholderStyle}}"
placeholder-class="{{placeholderClass}} {{classPrefix}}__placeholder {{classPrefix}}__placeholder--{{center ? 'center': 'normal'}}"
Expand All @@ -43,7 +44,7 @@
<view
wx:if="{{value !=='' && clearable && showClearIcon}}"
class="{{classPrefix}}__clear hotspot-expanded {{prefix}}-class-clear"
catch:tap="handleClear"
catch:touchstart="handleClear"
aria-role="button"
aria-label="清除"
>
Expand Down
8 changes: 8 additions & 0 deletions packages/components/search/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ export interface TdSearchProps {
value?: number;
required?: boolean;
};
/**
* 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制
* @default #0052d9
*/
cursorColor?: {
type: StringConstructor;
value?: string;
};
/**
* 搜索框聚焦时底部与键盘的距离
* @default 0
Expand Down
Loading