<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-08-14 16:50:51
 * @LastEditors: 无尘
 * @LastEditTime: 2019-10-09 11:41:32
 -->
<!--
<back-table-left></back-table-left>

import backTableLeft from '@/components/createApi/back-table-left.vue';
-->
<template>
  <div>
    <template v-for="(itemValue, itemName, index) in itemData.properties">
      <table v-if="!itemValue.constFlag" cellspacing="0" cellpadding="0" border="0" class="el-table__body" style="width: 100%;table-layout: fixed;" :key="index + itemName + 121">
        <tbody>
          <tr class="el-table__row">
            <td rowspan="1" colspan="1" class="el-table_1_column_1" style="width: 36px;">
              <div v-if="itemValue.type == 'object' || itemValue.type == 'array'" class="cell"><i class="el-icon-minus"></i></div>
            </td>
            <td rowspan="1" colspan="1" class="el-table_1_column_1">
              <div class="cell el-tooltip">
                <el-tooltip class="item" effect="dark" :content="itemName" placement="top">
                  <span>{{ itemName }}</span>
                </el-tooltip>
              </div>
            </td>
            <td rowspan="1" colspan="1" class="el-table_1_column_2">
              <div class="cell el-tooltip">{{ itemValue.frontOriginType }}</div>
            </td>
            <td rowspan="1" colspan="1" class="el-table_1_column_2">
              <div class="cell el-tooltip">{{ itemValue.type }}</div>
            </td>
          </tr>
        </tbody>
      </table>
      <back-table-row class="el-table__row" style="padding-left: 10px;" v-if="itemValue.type == 'array' && Object.keys(itemValue.items.properties).length" :itemData="itemValue.items" :key="index + '122' + itemName"> </back-table-row>
      <back-table-row class="el-table__row" style="padding-left: 10px;" v-if="itemValue.type == 'object' && Object.keys(itemValue.properties).length" :itemData="itemValue" :key="index + '122' + itemName"> </back-table-row>
    </template>
  </div>
</template>
<script>
export default {
  name: 'back-table-row',
  props: {
    itemData: {
      type: [Object, Array],
      default() {
        return {};
      }
    }
  },
  data() {
    return {
      trData: {}
    };
  },

  watch: {
    itemData: function(newData, oldData) {
      const that = this;
      that.trData = newData;
    }
  },
  mounted() {
    const that = this;
    that.trData = that.itemData;
  }
};
</script>
<style lang="less" scoped>
.w-320 {
  width: 320px;
}
.m-t-14 {
  margin-top: 14px;
}
.el-table .cell {
  line-height: 32px;
  white-space: nowrap;
  text-overflow: hidden;
  overflow: hidden;
}
</style>
