vueComponent / ant-design-vue-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design Vue like a Pro! (vue2)
https://pro.antdv.com
MIT License
10.77k stars 3.1k forks source link

组件用的s-table, 在国际化的时候必须页面刷新表头才会跟着刷新,有其他处理方式吗 #1452

Open gouyuwang opened 6 months ago

gouyuwang commented 6 months ago
  columns: [
        {
          title: this.$t('activity.list.name'),
          dataIndex: 'name'
        },
        ····
]
DogeLasVegas commented 4 months ago

同问,现在有什么解决办法吗

DogeLasVegas commented 4 months ago

搜到一种办法:

<template v-for="(item, index) in columns" :slot="item.slotName">
    <span :key="index">{{ $t(item.slotName) }}</span>
  </template>
{
    slotName: 'table.column.id',
    dataIndex: 'id',
    width: '185px',
    scopedSlots: { customRender: 'serial', title: 'table.column.id' },
  },

这样可以实现自动刷新

DogeLasVegas commented 4 months ago

还有一种:

columns: [
  {
    title: () => this.$t('table.serial'),
    scopedSlots: { customRender: 'serial' }
  }
]