Search.vue 855 Bytes
<template>
  <div class="search">
    <van-search v-model="value" :placeholder="placeholder" @search="onSearch" />
  </div>
</template>

<script type='text/ecmascript-6'>
export default {
  name: 'Search',
  props: {
    keyword: {
      type: String,
      default: ''
    },
    placeholder: {
      type: String,
      default: '请输入内容搜索'
    }
  },
  watch: {
    keyword(e) {
      this.value = e
    }
  },
  data() {
    return {
      value: this.keyword
    }
  },
  mounted() {},
  methods: {
    onSearch(e) {
      this.$emit('search', e)
    }
  }
}
</script>

<style scoped lang='scss'>
.van-search {
  padding: 9px 16px;
  height: 50px;
  background: #fff;
  .van-search__content {
    background-color: #fff;
    border: 1px solid #cdd1d4;
    border-radius: 16px;
  }
  .van-cell {
    padding: 5px 16px 5px 0;
  }
}
</style>