vue 根据返回的多个id显示多个类型模板

vue yekong

处理前数据

0,1,2

处理后数据

发送电子档、邮寄纸质档、现场领取

代码

/**
* @Author: 858834013@qq.com
* @Name: transactManner
* @Date: 2022-02-27
* @Desc:
*/
<template>
  <div>
    {{ transactManners }}
  </div>
</template>

<script>

export default {
  name: 'transactManner',
  components: {},
  props: {
    transactManner: {
      type: String,
      default() {
        return ''
      }
    }
  },
  computed: {
    transactManners: function() {
      var list2 = []
      if (this.transactManner) {
        var data = this.transactManner.split(',')
        var list = ['发送电子档', '邮寄纸质档', '现场领取']
        data.forEach((type) => {
          list2.push(list[type])
        })
        return list2.join('、')
      } else {
        return ''
      }
    }
  },
  data() {
    return {
      status: ''
    }
  },
  watch: {},
  mounted() {
  },
  methods: {}
}
</script>

<style lang="scss" scoped>

</style>

喜欢