<template>
  <div>
    <van-swipe
      v-if="dataType === 'default'"
      vertical
      class="bullet-notice-swipe"
      :style="{background:bgColor,color:textColor}"
      :autoplay="autoplay"
      :show-indicators="false"
    >
      <van-swipe-item v-for="(item,key) in bulletData" :key="key">
        <div class="bullet-content">
          <img v-if="item.avatar" :src="item.avatar" alt="">
          <span class="over">{{ item.text }}</span>
        </div>
      </van-swipe-item>
    </van-swipe>
    <div
      v-else
      class="bullet-notice-swipe"
      style="display: flex"
      :style="{background:bgColor,color:textColor}"
    >
      <div class="bullet-content">
        <span class="over">当前数据由事件传入</span>
      </div>
    </div>
  </div>
</template>

<script>
// import Vue from 'vue'
// import { Swipe, SwipeItem } from 'vant'
//
// Vue.use(Swipe)
// Vue.use(SwipeItem)
export default {
  name: 'DkBulletChat',
  props: {
    bgColor: { default: '', type: String },
    textColor: { default: '', type: String },
    dataType: { default: '', type: String }, // 内容来源
    eventName: { default: '', type: String }, // 事件名称
    autoplay: { default: 3000, type: Number },
    bulletData: { default: () => { return [] }, type: Array }
  },
  data() {
    return {}
  },
  computed: {},
  mounted() {},
  methods: {}
}
</script>

<style scoped lang="scss">
.bullet-notice-swipe {
  height: 30px;
  line-height: 30px;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  border-radius: 100px;
  .bullet-content{
    display: flex;
    align-items: center;
    height: 20px;
    margin: 5px;
    font-size: 12px;
    img{
      width: 20px;
      height: 20px;
      border-radius: 100%;
    }
    span{
      padding:0 5px;
    }
  }
}
</style>
