<!--
 * @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"
        :key="index + itemName + 121"
        cellspacing="0"
        cellpadding="0"
        border="0"
        class="el-table__body"
        style="width: 100%;table-layout: fixed;">
        <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" />
              </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
        v-if="itemValue.type == 'array' && Object.keys(itemValue.items.properties).length"
        :key="index + '122' + itemName"
        class="el-table__row"
        style="padding-left: 10px;"
        :item-data="itemValue.items" />
      <back-table-row
        v-if="itemValue.type == 'object' && Object.keys(itemValue.properties).length"
        :key="index + '122' + itemName"
        class="el-table__row"
        style="padding-left: 10px;"
        :item-data="itemValue" />
    </template>
  </div>
</template>
<script>
export default {
  name: 'BackTableRow',
  props: {
    itemData: {
      type: [ Object, Array ],
      default() {
        return {};
      }
    }
  },
  data() {
    return {
      trData: {}
    };
  },
  mounted() {
    const that = this;
    that.trData = that.itemData;
  },

  watch: {
    itemData: function(newData, oldData) {
      const that = this;
      that.trData = newData;
    }
  }
};
</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>
