此ID无法显示 2022-02-17 18:04 采纳率: 100%
浏览 795
已结题

vue3使用ant-design-vue中表格不渲染问题

问题遇到的现象和发生背景

img


https://next.antdv.com/components/table-cn#components-table-demo-fixed-columns-header
如上图所示,我按照官方文档把表格组件引入使用,但是我需要最后一列设置一些超链接进行一些动作,
结果是其他列正常渲染,但是到了最后一列一直无法渲染。
恳请各位看看是哪里有问题,谢谢

问题相关代码,请勿粘贴截图
<template>
  <div class="hall-wrapper">
    <div class="hall-header">
      <h1>Event Hall</h1>
      <p>Enjoy yourself and have a good time</p>
    </div>
    <div class="hall-content">
      <a-table :columns="columns" :data-source="eventList" :scroll="{ x: 1500, y: 300 }">
        <template #bodyCell="{ column }">
          <template v-if="column.key === 'operation'">
            <a>action</a>
          </template>
        </template>
      </a-table>
    </div>
  </div>
</template>

<script setup lang="ts">

  import {ref} from "vue";

  const columns = [
    { title: 'Name', width: 40, dataIndex: 'name', key: 'name', fixed: 'left' },
    { title: 'Time', width: 40, dataIndex: 'time', key: 'time'},
    { title: 'Location', width: 40, dataIndex: 'location', key: 'location'},
    { title: 'Content', width: 100, dataIndex: 'content', key: 'content'},
    { title: 'Principal', width: 40, dataIndex: 'principal', key: 'principal'},
    { title: 'Contact', width: 40, dataIndex: 'contact', key: 'contact'},
    { title: 'Action', width: 40, key: 'operation',fixed: 'right' }
  ]
  const eventList = ref([
    {
      name: 'Edrward 0',
      time: '2022-22-22 22:22:22 ~ 2033-33-33 33:33:33',
      location: 'xxxxxxxx',
      content: 'London Park no. 0',
      principal: 'zhangsan123',
      contact: '123456778901'
    },
    {
      name: 'Edrward 0',
      time: '2022-22-22 22:22:22 ~ 2033-33-33 33:33:33',
      location: 'xxxxxxxx',
      content: 'London Park no. 0',
      principal: 'zhangsan123',
      contact: '123456778901'
    },
    {
      name: 'Edrward 0',
      time: '2022-22-22 22:22:22 ~ 2033-33-33 33:33:33',
      location: 'xxxxxxxx',
      content: 'London Park no. 0',
      principal: 'zhangsan123',
      contact: '123456778901'
    }
  ])
</script>

<style scoped lang="css"></style>
运行结果及报错内容

img

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 2月26日
  • 已采纳回答 2月18日
  • 创建了问题 2月17日

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵