Skip to content

Commit

Permalink
fix: fix cr
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Jun 27, 2024
1 parent 09fa8e1 commit 97b17b5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/search/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports[`Search Search base demo works fine 1`] = `
class="example-search"
>
<t-search
placeholder="搜索预设文案,输入有预览结果"
placeholder="输入tdesign,有预览结果"
resultList="{{Array []}}"
bind:change="onChangeValue"
/>
Expand Down
4 changes: 0 additions & 4 deletions src/search/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ exports[`search Props :base 1`] = `
</wx-view>
</wx-view>
<wx-view
ariaRole="listbox"
class="t-search__result-list"
/>
</t-search>
</main>
`;
2 changes: 1 addition & 1 deletion src/search/_example/base/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
</view>

<view class="example-search">
<t-search placeholder="搜索预设文案,输入有预览结果" resultList="{{resultList}}" bind:change="onChangeValue" />
<t-search placeholder="输入tdesign,有预览结果" resultList="{{resultList}}" bind:change="onChangeValue" />
</view>
10 changes: 9 additions & 1 deletion src/search/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,16 @@
}
}
&__result-item {
&--hightlight {
&--highLight {
color: @brand-color;
}
}

&__result-list &__result-item {
padding-left: 0;

&::after {
left: 0;
}
}
}
5 changes: 3 additions & 2 deletions src/search/search.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./search.wxs" module="this"></wxs>

<view style="{{_._style([style, customStyle])}}" class="class {{classPrefix}} {{prefix}}-class">
<view
Expand Down Expand Up @@ -60,7 +61,7 @@
</view>
<slot wx:else name="action" />
</view>
<wxs src="./search.wxs" module="this"></wxs>

<view wx:if="{{isShowResultList && !isSelected}}" class="{{classPrefix}}__result-list" aria-role="listbox">
<t-cell
wx:for="{{resultList}}"
Expand All @@ -71,6 +72,6 @@
bind:tap="onSelectResultItem"
aria-role="option"
>
<rich-text slot="title" nodes="{{this.hightLight(item, value)}}"></rich-text>
<rich-text slot="title" nodes="{{this.highLight(item, value)}}"></rich-text>
</t-cell>
</view>
6 changes: 3 additions & 3 deletions src/search/search.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var hightLight = function (label, keyword) {
return label.replace(keyword, '<span class="t-search__result-item--hightlight">' + keyword + '</span>');
var highLight = function (label, keyword) {
return label.replace(keyword, '<span class="t-search__result-item--highLight">' + keyword + '</span>');
};
module.exports = {
hightLight: hightLight,
highLight: highLight,
};

0 comments on commit 97b17b5

Please sign in to comment.