<template>
  <el-image
    v-if="list && list.length"
    style="width: 100px; height: 100px"
    :src="list[0]"
    :preview-src-list="list"
  />
</template>

<script>
export default {
  props: ['text'],
  data() {
    return {
      list: [],
    }
  },
  watch: {
    text() {
      this.initData()
    },
  },
  created() {
    this.initData()
  },
  methods: {
    initData() {
      const { text = '' } = this
      console.log(text)
      if (typeof text === 'object') {
        this.list = text
      } else {
        this.list = text.split(',').filter((item) => item)
      }
    },
  },
}
</script>
