<template>
  <div class="course-tag-message">
    <div class="course-tag-message-hd">
      <div class="course-tag-message__title">{{data.name}}</div>
    </div>
    <div class="course-tag-message-bd">
      <template v-if="data.children && data.children.length">
        <ul class="message-tag-list">
          <template v-for="item in data.children">
            <li
              class="course-tag-item"
              :key="item.id"
              @click="$emit('search', item)"
            >{{item.name}}</li>
          </template>
        </ul>
      </template>
    </div>
    <div class="course-tag-message-ft">
      <div class="more">
        更多
        <van-icon name="arrow-down"></van-icon>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CourseTagMessage',
  props: {
    data: { type: Object }
  }
}
</script>

<style lang="scss" scoped>
.course-tag-message {
  padding: 10px;
  background-color: #fff;
  border-radius: 6px;
}
.course-tag-message-hd {
  padding: 10px 0;
  font-size: 15px;
  color: #222;
}
.course-tag-item {
  display: inline-block;
  height: 24px;
  margin: 0 10px 10px 0;
  padding: 0 15px;
  font-size: 13px;
  color: #fff;
  line-height: 24px;
  background: #67a8ff;
  border-radius: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  cursor: pointer;
}
.course-tag-message-ft {
  padding-top: 10px;
  border-top: 1px solid #eee;
}
.more {
  font-size: 13px;
  color: #222;
  text-align: center;
  cursor: pointer;
}
</style>
