index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <el-row
  3. class="basic-grid"
  4. :gutter="config.gutter"
  5. :type="config.componentType"
  6. :align="config.align"
  7. :justify="config.justify">
  8. <template
  9. v-for="({children,...col},optionIndex) in options"
  10. :key="optionIndex">
  11. <el-col
  12. v-bind="col"
  13. class="basic-grid__col">
  14. <slot
  15. name="item"
  16. :children="children"
  17. :optionIndex="optionIndex"
  18. :is-show="config._isShow"
  19. :addOptionChild="addOptionChild"
  20. :deleteOptionChild="deleteOptionChild"
  21. :copyOptionChild="copyOptionChild"
  22. :updateOptionChildren="updateOptionChildren"
  23. :updateOptionChild="updateOptionChild"></slot>
  24. </el-col>
  25. </template>
  26. </el-row>
  27. </template>
  28. <script>
  29. import { ElRow, ElCol } from 'element-plus'
  30. import { layoutProps } from '../layout-props'
  31. import { useFormLayoutOptions } from '../../hooks/use-form-layout'
  32. export default {
  33. name: 'BasicGrid',
  34. props: layoutProps,
  35. components: {
  36. ElRow,
  37. ElCol
  38. },
  39. emits: ['update:config', 'selectItem'],
  40. setup (props, { emit }) {
  41. const formLayoutOptions = useFormLayoutOptions({ props, emit })
  42. return {
  43. ...formLayoutOptions
  44. }
  45. }
  46. }
  47. </script>
  48. <style lang="less">
  49. .basic-grid{
  50. overflow: hidden;
  51. }
  52. </style>