AntD表格列不会在其值中呈现前导或尾随空格。
创始人
2024-11-07 10:00:49
0

在AntD表格中,列不会显示前导或尾随空格的解决方法如下所示:

  1. 使用JavaScript的trim()方法去除列值中的前导和尾随空格。
import React from "react";
import { Table } from "antd";

const data = [
  {
    key: "1",
    name: " John ",
    age: 32,
    address: " New York ",
  },
  {
    key: "2",
    name: " Jane ",
    age: 28,
    address: " London ",
  },
  {
    key: "3",
    name: " Bob ",
    age: 40,
    address: " Sydney ",
  },
];

const columns = [
  {
    title: "Name",
    dataIndex: "name",
    key: "name",
    render: (text) => text.trim(), // 使用trim()方法去除前导和尾随空格
  },
  {
    title: "Age",
    dataIndex: "age",
    key: "age",
  },
  {
    title: "Address",
    dataIndex: "address",
    key: "address",
    render: (text) => text.trim(), // 使用trim()方法去除前导和尾随空格
  },
];

const App = () => {
  return ;
};

export default App;

在上面的示例代码中,通过在render属性中使用trim()方法,将列值中的前导和尾随空格去除。这样,AntD表格中的列将不会显示前导或尾随空格。

相关内容

热门资讯

总结透视!wepoker透视底... 总结透视!wepoker透视底牌,微乐脚本辅助器,教程书教程(有挂存在)-哔哩哔哩1、起透看视 we...
辅助透视!wepoker透视方... 辅助透视!wepoker透视方法,微乐家乡游戏攻略,指南教程(果真有挂)-哔哩哔哩所有人都在同一条线...
了解透视!hhpoker底牌透... 了解透视!hhpoker底牌透视脚本,微乐家乡app下载,要领教程(有挂方法)-哔哩哔哩1、玩家可以...
专业透视!扑克之星辅助,微乐麻... 专业透视!扑克之星辅助,微乐麻辣自建房辅助视频,妙计教程(的确有挂)-哔哩哔哩1、实时扑克之星辅助透...
了解透视!hhpoker怎么开... 了解透视!hhpoker怎么开透视,微乐游戏辅助脚本安卓,方式教程(有挂讲解)-哔哩哔哩1、hhpo...
科普透视!wpk辅助哪里买,微... 科普透视!wpk辅助哪里买,微乐家乡官方app,技法教程(有挂教程)-哔哩哔哩1.wpk辅助哪里买 ...
分享透视!德州局透视,微信微乐... 分享透视!德州局透视,微信微乐游戏有辅助吗,练习教程(确实有挂)-哔哩哔哩1、下载好德州局透视正确养...
揭露透视!we-poker软件... 揭露透视!we-poker软件,陕西微乐小程序脚本,妙计教程(发现有挂)-哔哩哔哩we-poker软...
揭露透视!hhpoker软件可... 揭露透视!hhpoker软件可以玩吗,微乐小程序辅助器,积累教程(有挂头条)-哔哩哔哩1、hhpok...
关于透视!hhpoker开挂教... 您好,hhpoker开挂教程这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302】...