Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug]: form组件使用复杂布局,设置不同的size时,date-picker的高度不一致 #2490

Closed
Lymanli opened this issue Nov 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Lymanli
Copy link

Lymanli commented Nov 6, 2024

Version

3.19.0

Vue Version

3.4.27

Link to minimal reproduction

<template>
  <div class="demo-form">
    size值:{{formSize}}
    <tiny-button @click="setSize('small')">small</tiny-button>
    <tiny-button @click="setSize('medium')">medium</tiny-button>
    <tiny-button @click="setSize('mini')">mini</tiny-button>
    <tiny-button @click="setSize(null)">null</tiny-button>
    <hr/>
    isDaterange值:{{isDaterange?'daterange':'date'}}
    <tiny-button @click="setDaterange">null/daterange</tiny-button>
    <hr/>
    <tiny-form ref="ruleFormRef" :model="createData" label-width="100px" :size="formSize" >
      <tiny-row>
        <tiny-col :span="4">
          <tiny-form-item label="输入框" prop="users" validate-position="top-end">
            <tiny-input></tiny-input>
          </tiny-form-item>
        </tiny-col>
        <tiny-col :span="4">
          <tiny-form-item label="日期" prop="datepicker" validate-position="bottom-end">
            <tiny-date-picker v-model="createData.datepicker" :type="isDaterange?'daterange':'date'" start-placeholder="开始日期" range-separator="" end-placeholder="结束日期"></tiny-date-picker>
          </tiny-form-item>
        </tiny-col>
        <tiny-col :span="4">
          <tiny-form-item label="必填" prop="users" validate-position="top-end">
            <tiny-checkbox-group v-model="createData.checked">
              <tiny-checkbox label="复选框1"></tiny-checkbox>
              <tiny-checkbox label="复选框2"></tiny-checkbox>
            </tiny-checkbox-group>
          </tiny-form-item>
        </tiny-col>
        <tiny-col :span="4">
          <tiny-form-item label="URL" prop="url">
            <tiny-checkbox-group v-model="createData.checked">
              <tiny-checkbox label="复选框1"></tiny-checkbox>
              <tiny-checkbox label="复选框2"></tiny-checkbox>
            </tiny-checkbox-group>
          </tiny-form-item>
        </tiny-col>
        <tiny-col :span="4">
          <tiny-form-item label="邮件" prop="email">
            <tiny-input v-model="createData.email"></tiny-input>
          </tiny-form-item>
        </tiny-col>
      </tiny-row>
      <tiny-row>
        <tiny-col :span="12">
          <tiny-form-item label="整行文本">
            <tiny-input v-model="createData.textarea" type="textarea" maxlength="15"></tiny-input>
          </tiny-form-item>
        </tiny-col>
      </tiny-row>
      <tiny-row>
        <tiny-col :span="12">
          <tiny-form-item>
            <tiny-button type="primary"> 提交 </tiny-button>
          </tiny-form-item>
        </tiny-col>
      </tiny-row>
    </tiny-form>
  </div>
</template>

<script setup>
import { ref, reactive } from 'vue'
import { Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput, DatePicker as TinyDatePicker, Button as TinyButton, Row as TinyRow, Col as TinyCol, Checkbox as TinyCheckbox, CheckboxGroup as TinyCheckboxGroup } from '@opentiny/vue'

const ruleFormRef = ref()
const createData = reactive({
  users: '',
  url: '',
  email: '',
  datepicker: '',
  textarea: ''
})

const formSize=ref('')
const setSize=v=>{
  formSize.value=v
}
const isDaterange=ref(false)
const setDaterange=()=>{
  isDaterange.value=!isDaterange.value
}
</script>

<style scoped>
.demo-form {
}
</style>

Step to reproduce

顶部有按钮small、medium、mini、null分别设置form的size值,null/daterange按钮设置日期标签中的date-picker组件的type值为daterange或date。

  1. 当date-picker的type值为date时,依次点击按钮small、medium、mini、null,可以观察到small、mini值的时候,form表单中组件输入框、日期标签的组件高度不同导致URL标签的组件前面空出一片区域;
    image
    image

  2. 点击null/daterange按钮切换date-picker的type值为daterange时,重复步骤1依次切换form的size值,输入框高度不一致导致URL标签前面空出一片区域;
    image
    image

What is expected

from在复杂布局下,form的size值在不同时,且date-picker的type值不同时,表单组件不会因个别组件高度不同而前面空出一片。

What is actually happening

from在复杂布局下,form的size值在small和mini,date-picker的type在date和daterange时,表单中input、date-picker高度与checkbox高度不一致,导致表单组件没有按顺序排列而是空出一片

What is your project name

form表单

Any additional comments (optional)

No response

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]: The form component uses a complex layout. When different sizes are set, the heights between components are inconsistent.

@kagol kagol added the bug Something isn't working label Nov 7, 2024
@Lymanli Lymanli changed the title 🐛 [Bug]: form组件使用复杂布局,设置不同的size时,组件之间的高度不一致 🐛 [Bug]: form组件使用复杂布局,设置不同的size时,date-picker的高度不一致 Nov 7, 2024
@gimmyhehe
Copy link
Member

已修复,待发布补丁包~

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Fixed, patch package to be released~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants