<template>
  <div class="dynamic-form">
    <h2>{{title}}</h2>
      <Form class="dynamic-form-component" :label-width="80" :model="propsForm" @submit.native.prevent>
      <h3>基础属性</h3>
      <h4>标题栏</h4>
      <template v-for="(item, index) in titleSchema">
        <FormItem class="Df-component-formitem" :label="item.name" :key="'titleSchema_' + index">
            <component :is="item.type" :options="item.options" v-bind="item.props" v-model="propsForm[item.key]"  :formControl="item.formControl" />
          </FormItem>
        </template>
      <h4>底部提示</h4>
      <template v-for="(item, index) in bottomSchema">
        <FormItem class="Df-component-formitem" :label="item.name" :key="'bottomSchema_' + index">
          <component :is="item.type" :options="item.options" v-bind="item.props" v-model="propsForm[item.key]"  :formControl="item.formControl" />
        </FormItem>
      </template>
      <h4>悬浮窗</h4>
      <template v-for="(item, index) in floatSchema">
        <FormItem class="Df-component-formitem" :label="item.name" :key="'floatSchema_' + index">
          <component :is="item.type" :options="item.options" v-bind="item.props" v-model="propsForm[item.key]" :formDefault="item.formDefault" :formControl="item.formControl" />
        </FormItem>
      </template>
      </Form>
      <Form class="dynamic-form-component" :label-width="80" :model="commonStyleForm" @submit.native.prevent>
        <h3>基础样式</h3>
        <template v-for="(item, index) in commonStyleSchame">
        <FormItem class="Df-component-formitem" :label="item.name" :key="index">
            <component :is="item.type" :options="item.options" v-bind="item.props" v-model="commonStyleForm[item.key]" />
          </FormItem>
        </template>
    </Form>
  </div> 
</template>
<script lang="ts" src="./index.ts"></script>
<style lang="less" scoped>
  .dynamic-form {
      background: #fff;
      h2 {
        padding: 17px 0;
        border-bottom: 8px solid #F5F6FA;
        text-align: center;
      }
      h3, h4 {
        padding: 10px 0;
        margin-bottom: 10px;
        border-bottom: 1px solid #ebeef5;
      }
      &-component {
        padding: 0 20px;
        border-bottom: 8px solid #F5F6FA;
      }
      &-basic {
        padding: 0 20px;
        .Df-basic-inputnumber {
          margin-right: 10px;
        }
      }
      /deep/ .ivu-form-item-label {
        font-size: 14px;
      }

      /deep/ .ivu-input-number {
        width: 60px;
      }

      /deep/ .ivu-form-item-content {
        .ivu-tooltip {
          margin-right: 6px;
          .ivu-btn-ghost {
            padding: 2px 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            .ivu-icon {
              font-size: 20px;
            }
          }
          &:last-child {
            .ivu-icon {
              transform: rotate(90deg);
            }
          }
        }
      }
  }
</style>