Riku
2024-08-13 093afd3be27ea5e9692839845b69bd56e2405518
miniprogram_npm/tdesign-miniprogram/search/search.wxml
@@ -1,8 +1,9 @@
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./search.wxs" module="this"></wxs>
<view style="{{_._style([style, customStyle])}}" class="class {{classPrefix}} {{prefix}}-class">
  <view
    class="{{classPrefix}}__input-box {{prefix}}-{{localValue.focus ? 'is-focused' : 'not-focused'}} {{classPrefix}}__input-box--{{center ? 'center' : ''}} {{classPrefix}}__input-box--{{shape}} {{prefix}}-class-input-container"
    class="{{classPrefix}}__input-box {{prefix}}-{{focus ? 'is-focused' : 'not-focused'}} {{classPrefix}}__input-box--{{center ? 'center' : ''}} {{classPrefix}}__input-box--{{shape}} {{prefix}}-class-input-container"
  >
    <!-- <view wx:if="{{label}}" class="{{classPrefix}}__label {{prefix}}-class-label">{{label}}</view>
    <slot name="label" /> -->
@@ -13,17 +14,28 @@
      class="{{prefix}}-icon {{prefix}}-class-left"
      aria-hidden="{{true}}"
    />
    <slot name="left-icon" />
    <slot wx:else name="left-icon" />
    <input
      type="{{type}}"
      name="input"
      maxlength="{{maxlength}}"
      disabled="{{disabled}}"
      class="{{prefix}}-input__keyword {{prefix}}-class-input"
      focus="{{localValue.focus}}"
      focus="{{focus}}"
      value="{{value}}"
      confirm-type="search"
      confirm-type="{{confirmType}}"
      confirm-hold="{{confirmHold}}"
      cursor="{{cursor}}"
      adjust-position="{{adjustPosition}}"
      always-embed="{{alwaysEmbed}}"
      selection-start="{{selectionStart}}"
      selection-end="{{selectionEnd}}"
      hold-keyboard="{{holdKeyboard}}"
      cursor-spacing="{{cursorSpacing}}"
      placeholder="{{placeholder}}"
      placeholder-class="{{classPrefix}}__placeholder {{classPrefix}}__placeholder--{{center ? 'center': 'normal'}}"
      placeholder-style="{{placeholderStyle}}"
      placeholder-class="{{placeholderClass}} {{classPrefix}}__placeholder {{classPrefix}}__placeholder--{{center ? 'center': 'normal'}}"
      bind:input="onInput"
      bind:focus="onFocus"
      bind:blur="onBlur"
@@ -32,7 +44,7 @@
    <view
      wx:if="{{value !=='' && clearable}}"
      class="{{classPrefix}}__clear {{prefix}}-class-clear"
      bind:tap="handleClear"
      catch:tap="handleClear"
      aria-role="button"
      aria-label="清除"
    >
@@ -42,10 +54,24 @@
  <view
    wx:if="{{action}}"
    class="{{classPrefix}}__search-action {{prefix}}-class-action"
    bindtap="onActionClick"
    catch:tap="onActionClick"
    aria-role="button"
  >
    {{action}}
  </view>
  <slot name="action" />
  <slot wx:else name="action" />
</view>
<view wx:if="{{isShowResultList && !isSelected}}" class="{{classPrefix}}__result-list" aria-role="listbox">
  <t-cell
    wx:for="{{resultList}}"
    wx:key="index"
    data-index="{{index}}"
    class="{{classPrefix}}__result-item"
    hover
    bind:tap="onSelectResultItem"
    aria-role="option"
  >
    <rich-text slot="title" nodes="{{this.highLight(item, value)}}"></rich-text>
  </t-cell>
</view>