Newer
Older
smartwell_front / src / views / overview / components / mapSearchItem.vue
wangxitong on 22 Aug 2022 1 KB Changes 章丘地图
<!--
 * @Description: 搜索结果项组件
 * @Author: 王晓颖
 * @Date: 2022-05-18
 -->
<template>
  <div :key="data[props.label]" class="search-card" @click="clickItem()">
    <div class="card-left">
      <span class="index">{{ index+1 }}</span>
    </div>
    <div class="card-right">
      <div class="card-title">
        {{ data[props.label] }}-{{ data[props.name] }}
      </div>
      <div class="card-content">
        <span class="card-detail">{{ data[props.detail] }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SearchItem',
  props: {
    data: {
      type: Object,
      required: true
    },
    index: {
      type: Number | String,
      required: true
    },
    props: {
      type: Object,
      default: () => {
        return {
          label: 'wellCode',
          name: 'wellName',
          detail: 'position'
        }
      }
    }
  },
  data() {
    return {
    }
  },
  methods: {
    clickItem() {
      console.log(this.data)
      this.$emit('click', this.data)
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.search-card{
  padding:5px 10px;
  overflow: auto;
  display: flex;
  .card-left{
    .index{
      display: inline-block;
      width: 20px;
      line-height: 20px;
      background-color: #cfe3fa;
      text-align: center;
      border-radius: 20px;
      margin: 3px 10px 0px 0px;
    }
  }
  .card-right{
    flex:1
  }
  .card-title{
    font-size:16px;
    font-weight: bold;
    line-height: 25px;
  }
  .card-detail{
    line-height:25px;
  }
  &:hover{
    cursor:pointer;
    background-color: #fafafa;
  }
}
</style>