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

feat(Search): support cursor-spacing attr #2065

Merged
merged 2 commits into from
Jun 6, 2023
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
1 change: 1 addition & 0 deletions src/search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ action | String / Slot | '' | 自定义右侧操作按钮文字 | N
center | Boolean | false | 是否居中 | N
disabled | Boolean | false | 是否禁用 | N
external-classes | Array | - | 组件外部样式类名,分别用于设置组件外层类名、输入框类名、输入框容器类名、右侧 cancel 文本类名、左侧图标类名、右侧图标类型。`['t-class', 't-class-input', 't-class-input-container', 't-class-action','t-class-left','t-class-clear']` | N
cursor-spacing | Number | 0 | 搜索框聚焦时底部与键盘的距离 | N
focus | Boolean | false | 是否聚焦 | N
label | String | '' | 已废弃。左侧文本 | N
left-icon | String / Slot | 'search' | 左侧图标 | N
Expand Down
1 change: 1 addition & 0 deletions src/search/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`search Props :base 1`] = `
<wx-input
class="t-input__keyword t-class-input"
confirmType="search"
cursorSpacing="{{0}}"
disabled="{{false}}"
focus="{{false}}"
name="input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`search Props :base 1`] = `
<wx-input
class="t-input__keyword t-class-input"
confirmType="search"
cursorSpacing="{{0}}"
disabled="{{false}}"
focus="{{false}}"
name="input"
Expand Down
5 changes: 5 additions & 0 deletions src/search/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ const props: TdSearchProps = {
externalClasses: {
type: Array,
},
/** 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 */
cursorSpacing: {
type: Number,
value: 0,
},
/** 是否聚焦 */
focus: {
type: Boolean,
Expand Down
1 change: 1 addition & 0 deletions src/search/search.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
focus="{{localValue.focus}}"
value="{{value}}"
confirm-type="search"
cursor-spacing="{{cursorSpacing}}"
placeholder="{{placeholder}}"
placeholder-class="{{classPrefix}}__placeholder {{classPrefix}}__placeholder--{{center ? 'center': 'normal'}}"
bind:input="onInput"
Expand Down
8 changes: 8 additions & 0 deletions src/search/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ export interface TdSearchProps {
type: ArrayConstructor;
value?: ['t-class', 't-class-input', 't-class-input-container', 't-class-cancel', 't-class-left', 't-class-right'];
};
/**
* 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离
* @default 0
*/
cursorSpacing?: {
type: NumberConstructor;
value?: number;
};
/**
* 是否聚焦
* @default false
Expand Down