CommonForm.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <el-row>
  3. <el-col :span="24">
  4. <el-form
  5. :model="commonForm"
  6. ref="commonForm"
  7. class="sub-form"
  8. :validate-on-rule-change="false"
  9. >
  10. <el-form-item label="单位" label-width="110px" prop="unit">
  11. <el-input v-model.trim="commonForm.unit" placeholder="请输入单位" @blur="handleValue('unit')"></el-input>
  12. </el-form-item>
  13. </el-form>
  14. </el-col>
  15. </el-row>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'CommonForm',
  20. props: ['data'],
  21. data() {
  22. return {
  23. commonForm: {
  24. unit: ''
  25. }
  26. };
  27. },
  28. computed: {},
  29. created() {
  30. this._initData();
  31. },
  32. mounted() {},
  33. methods: {
  34. _initData() {
  35. this.commonForm.unit = this.data.unit;
  36. },
  37. // 传值
  38. handleValue(from) {
  39. this.$emit('handleInput', {
  40. type: from,
  41. value: this.commonForm[from]
  42. });
  43. }
  44. }
  45. };
  46. </script>
  47. <style lang="less" scoped>
  48. .turns {
  49. text-align: center;
  50. height: 40px;
  51. line-height: 40px;
  52. color: #dcdfe6;
  53. }
  54. </style>