<script>
export default {
  name: 'MFormItem'
}
</script>

<script setup>
import { inject, computed } from 'vue'

defineProps({
  label: {
    type: String,
  }
})

const form = inject('Form')
</script>

<template>
  <div class="m-form-item">
    <label :style="{width: form.props.labelWidth}" class="m-form-item__label">{{ label }}</label>
    <div class="m-form-item__content">
      <slot></slot>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.m-form-item{
  margin-bottom: 25px;

  .m-form-item__label {
    text-align: right;
    vertical-align: middle;
    float: left;
    font-size: 14px;
    color: #606266;
    line-height: 40px;
    padding: 0 12px 0 0;
    box-sizing: border-box;
  }

  .m-form-item__content {
    line-height: 40px;
    position: relative;
    font-size: 14px;
    overflow: hidden;
  }
}
</style>
