当前位置:   article > 正文

vue循环遍历动态数组子组件(含子组件表单校验)_vue遍历展示多个组件

vue遍历展示多个组件

父组件引用

  1. <arrange-info
  2. :formRef="formRef"
  3. :leaveDate="this.infoData.leaveDate"
  4. @addWorkArrange="addWorkArrange"
  5. @deleteWorkArrange="deleteWorkArrange"
  6. @saveWorkArrange="saveWorkArrange"
  7. @creatWorkArrange="creatWorkArrange"
  8. @edit="edit"
  9. @cancelWorkArrange="cancelWorkArrange"
  10. style="margin-top: 20px"
  11. ></arrange-info>

 子组件

  1. <template>
  2. <div class="arrangeInfo">
  3. <div class="title">离职工作安排</div>
  4. <el-form ref="formRef" :model="formRef" :rules="arrangeRules">
  5. <div class="content" v-for="(item, index) in formRef.arrangeList" :key="index">
  6. <div class="left">
  7. <div class="label">离职工作安排</div>
  8. </div>
  9. <div class="middle">
  10. <div class="top">
  11. <div class="date" >
  12. <span v-if="item.isEdit"><span class="required" style="color: #c8152d">*</span>交接日期</span>
  13. <el-form-item :prop="`arrangeList.${index}.dateRange`" :rules="{ required: true, message: '请选择',trigger: 'change' }" v-if="item.isEdit">
  14. <el-date-picker
  15. v-model="item.dateRange"
  16. type="daterange"
  17. range-separator="-"
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/115754
推荐阅读
相关标签
  

闽ICP备14008679号