<template>
<uni-shadow-root class="vant-search-index"><view :class="(utils.bem('search', { withaction: showAction || useActionSlot }))+' custom-class'" :style="'background: '+(background)">
  <view :class="utils.bem('search__content', [shape])">
    <view class="van-search__label" v-if="label">{{ label }}</view>
    <slot v-else name="label"></slot>

    <van-field clearable type="search" left-icon="search" :focus="focus" :error="error" :border="false" confirm-type="search" class="van-search__field field-class" :value="value" :disabled="disabled" :readonly="readonly" :maxlength="maxlength" :input-align="inputAlign" input-class="input-class" :placeholder="placeholder" :placeholder-style="placeholderStyle" custom-style="padding: 5px 10px 5px 0; background-color: transparent;" @blur="onBlur" @focus="onFocus" @change="onChange" @confirm="onSearch" @clear="onClear"></van-field>
  </view>

  <view v-if="showAction || useActionSlot" class="van-search__action" hover-class="van-search__action--hover" hover-stay-time="70">
    <slot v-if="useActionSlot" name="action"></slot>
    <view v-else @click="onCancel" class="cancel-class">取消</view>
  </view>
</view></uni-shadow-root>
</template>
<wxs src="../wxs/utils.wxs" module="utils"></wxs>
<script>
import VanField from '../field/index.vue'
global['__wxVueOptions'] = {components:{'van-field': VanField}}

global['__wxRoute'] = 'vant/search/index'
"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require('./../common/component.js');
component_1.VantComponent({
    field: true,
    classes: ['field-class', 'input-class', 'cancel-class'],
    props: {
        focus: Boolean,
        error: Boolean,
        disabled: Boolean,
        readonly: Boolean,
        inputAlign: String,
        showAction: Boolean,
        useActionSlot: Boolean,
        placeholder: String,
        placeholderStyle: String,
        background: {
            type: String,
            value: '#ffffff'
        },
        maxlength: {
            type: Number,
            value: -1
        },
        shape: {
            type: String,
            value: 'square'
        },
        label: String
    },
    methods: {
        onChange: function onChange(event) {
            this.set({ value: event.detail });
            this.$emit('change', event.detail);
        },
        onCancel: function onCancel() {
            var _this = this;
            /**
             * 修复修改输入框值时，输入框失焦和赋值同时触发，赋值失效
             * // https://github.com/youzan/vant-weapp/issues/1768
             */
            setTimeout(function () {
                _this.set({ value: '' });
                _this.$emit('cancel');
                _this.$emit('change', '');
            }, 200);
        },
        onSearch: function onSearch() {
            this.$emit('search', this.data.value);
        },
        onFocus: function onFocus() {
            this.$emit('focus');
        },
        onBlur: function onBlur() {
            this.$emit('blur');
        },
        onClear: function onClear() {
            this.$emit('clear');
        }
    }
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIk9iamVjdCIsInZhbHVlIiwiY29tcG9uZW50XzEiLCJyZXF1aXJlIiwiZmllbGQiLCJjbGFzc2VzIiwicHJvcHMiLCJmb2N1cyIsImVycm9yIiwiZGlzYWJsZWQiLCJyZWFkb25seSIsImlucHV0QWxpZ24iLCJzaG93QWN0aW9uIiwidXNlQWN0aW9uU2xvdCIsInBsYWNlaG9sZGVyIiwicGxhY2Vob2xkZXJTdHlsZSIsImJhY2tncm91bmQiLCJ0eXBlIiwibWF4bGVuZ3RoIiwic2hhcGUiLCJsYWJlbCIsIlN0cmluZyIsIm1ldGhvZHMiLCJvbkNoYW5nZSIsImV2ZW50Iiwib25DYW5jZWwiLCJfdGhpcyIsInNldFRpbWVvdXQiLCJvblNlYXJjaCIsIm9uRm9jdXMiLCJvbkJsdXIiLCJvbkNsZWFyIl0sIm1hcHBpbmdzIjoiOztBQUNBQSxPQUFBQSxjQUFBQSxDQUFBQSxPQUFBQSxFQUFBQSxZQUFBQSxFQUE2QyxFQUFFQyxPQUEvQ0QsSUFBNkMsRUFBN0NBO0FBQ0EsSUFBSUUsY0FBY0MsUUFBbEIsMEJBQWtCQSxDQUFsQjtBQUNBRCxZQUFBQSxhQUFBQSxDQUEwQjtBQUN0QkUsV0FEc0IsSUFBQTtBQUV0QkMsYUFBUyxDQUFBLGFBQUEsRUFBQSxhQUFBLEVBRmEsY0FFYixDQUZhO0FBR3RCQyxXQUFPO0FBQ0hDLGVBREcsT0FBQTtBQUVIQyxlQUZHLE9BQUE7QUFHSEMsa0JBSEcsT0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1ZTogJyNmZmZmZmYnXG4gICAgICAgIH0sXG4gICAgICAgIG1heGxlbmd0aDoge1xuICAgICAgICAgICAgdHlwZTogTnVtYmVyLFxuICAgICAgICAgICAgdmFsdWU6IC0xXG4gICAgICAgIH0sXG4gICAgICAgIHNoYXBlOiB7XG4gICAgICAgICAgICB0eXBlOiBTdHJpbmcsXG4gICAgICAgICAgICB2YWx1ZTogJ3NxdWFyZSdcbiAgICAgICAgfSxcbiAgICAgICAgbGFiZWw6IFN0cmluZ1xuICAgIH0sXG4gICAgbWV0aG9kczoge1xuICAgICAgICBvbkNoYW5nZTogZnVuY3Rpb24gKGV2ZW50KSB7XG4gICAgICAgICAgICB0aGlzLnNldCh7IHZhbHVlOiBldmVudC5kZXRhaWwgfSk7XG4gICAgICAgICAgICB0aGlzLiRlbWl0KCdjaGFuZ2UnLCBldmVudC5kZXRhaWwpO1xuICAgICAgICB9LFxuICAgICAgICBvbkNhbmNlbDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIF90aGlzID0gdGhpcztcbiAgICAgICAgICAgIC8qKlxuICAgICAgICAgICAgICog5L+u5aSN5L+u5pS56L6T5YWl5qGG5YC85pe277yM6L6T5YWl5qGG5aSx54Sm5ZKM6LWL5YC85ZCM5pe26Kem5Y+R77yM6LWL5YC85aSx5pWIXG4gICAgICAgICAgICAgKiAvLyBodHRwczovL2dpdGh1Yi5jb20veW91emFuL3ZhbnQtd2VhcHAvaXNzdWVzLzE3NjhcbiAgICAgICAgICAgICAqL1xuICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgX3RoaXMuc2V0KHsgdmFsdWU6ICcnIH0pO1xuICAgICAgICAgICAgICAgIF90aGlzLiRlbWl0KCdjYW5jZWwnKTtcbiAgICAgICAgICAgICAgICBfdGhpcy4kZW1pdCgnY2hhbmdlJywgJycpO1xuICAgICAgICAgICAgfSwgMjAwKTtcbiAgICAgICAgfSxcbiAgICAgICAgb25TZWFyY2g6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHRoaXMuJGVtaXQoJ3NlYXJjaCcsIHRoaXMuZGF0YS52YWx1ZSk7XG4gICAgICAgIH0sXG4gICAgICAgIG9uRm9jdXM6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHRoaXMuJGVtaXQoJ2ZvY3VzJyk7XG4gICAgICAgIH0sXG4gICAgICAgIG9uQmx1cjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy4kZW1pdCgnYmx1cicpO1xuICAgICAgICB9LFxuICAgICAgICBvbkNsZWFyOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB0aGlzLiRlbWl0KCdjbGVhcicpO1xuICAgICAgICB9LFxuICAgIH1cbn0pO1xuIl0sImZpbGUiOiJpbmRleC5qcyJ9
export default global['__wxComponents']['vant/search/index']
</script>
<style platform="mp-weixin">
@import '../common/index.css';.van-search{padding:10px 16px;-webkit-align-items:center;align-items:center;box-sizing:border-box}.van-search,.van-search__content{display:-webkit-flex;display:flex}.van-search__content{padding-left:10px;background-color:#f7f8fa;border-radius:2px;-webkit-flex:1;flex:1}.van-search__content--round{border-radius:17px}.van-search__label{padding:0 5px;font-size:14px;line-height:34px;color:#333}.van-search__field{-webkit-flex:1;flex:1}.van-search__field__left-icon{color:#999}.van-search--withaction{padding-right:0}.van-search__action{padding:0 10px;font-size:14px;line-height:34px;color:#333}.van-search__action--hover{background-color:#f2f3f5}
</style>