| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | 
							- <template>
 
-     <view class="search-box">
 
-         <view class="search">
 
-             <icon class="icon" type="search" size="3.733vw" />
 
-             <input v-model="value" class="input" confirm-type="search" placeholder-style="font-size:3.733vw;"
 
-                 :placeholder="placeholder" type="text" @confirm="onConfirm">
 
-             <icon v-if="value" class="icon" type="clear" size="3.733vw" @click="onClear" />
 
-         </view>
 
-         <slot />
 
-     </view>
 
- </template>
 
- <script>
 
- export default {
 
-     props: {
 
-         placeholder: {
 
-             type: String,
 
-             default: "搜索关键字"
 
-         },
 
-         onSearch: {
 
-             type: Function
 
-         }
 
-     },
 
-     data() {
 
-         return {
 
-             value: ""
 
-         }
 
-     },
 
-     methods: {
 
-         onConfirm() {
 
-             this.$emit("onSearch", this.value)
 
-         },
 
-         onClear() {
 
-             this.value = '';
 
-             this.$emit("onSearch", this.value)
 
-         }
 
-     },
 
- }
 
- </script>
 
- <style lang="scss">
 
- .search-box {
 
-     display: flex;
 
-     width: 100%;
 
-     box-sizing: border-box;
 
-     .search {
 
-         display: flex;
 
-         align-items: center;
 
-         flex: 1;
 
-         height: 30px;
 
-         background: #F2F2F2;
 
-         border-radius: 50px;
 
-         flex-shrink: 0;
 
-         margin: 0 !important;
 
-         .icon {
 
-             padding: 10px;
 
-         }
 
-         .input {
 
-             flex: 1;
 
-             margin: 0 !important;
 
-         }
 
-     }
 
- }
 
- </style>
 
 
  |