Skip to content

Transfer组件在Modal组件中会因浏览器缩放而产生宽度无限增长的问题 #8429

@muyeluoluo

Description

@muyeluoluo
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

vue3

Reproduction link

https://www.antdv.com/components/transfer-cn

Steps to reproduce

创建一个Modal,将Transfer放入

What is expected?

期望宽度正常

What is actually happening?

宽度无限变长

<template>
  <a-modal title="Modal" :open="true" centered destroyOnClose :maskClosable="false" :width="700">
    <div>
      <a-row :gutter="[12, 12]">
        <a-col :span="24">
          <a-transfer
            :targetKeys="[]"
            :dataSource="dataSource"
            show-search
            :showSelectAll="false"
            :titles="['未选择', '已选择']"
          >
            <template #children="{ filteredItems }">
              <a-table :columns="columns" :data-source="filteredItems" :pagination="false" :scroll="{ y: 300 }" />
            </template>
          </a-transfer>
        </a-col>
      </a-row>
    </div>
  </a-modal>
</template>

<script setup lang="ts">
  const dataSource = ref<RecordArr>([
    {
      id: 11,
      key1: '11111',
      key2: '2222'
    },
    {
      id: 333,
      key1: '333',
      key2: '444'
    }
  ]);
  // 穿梭框左侧
  const columns = reactive<Record<string, any>[]>([
    {
      title: '字段一',
      key: 'key1',
      dataIndex: 'key1'
    },
    {
      title: '字段二',
      key: 'key2',
      dataIndex: 'key2'
    }
  ]);
</script>
<style lang="less" scoped></style>
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions