The serial number of the vue.js iview table cannot be rendered.


{

            title: "",
            type: "index2",
            width: 75,
            align: "center",
            render: (h: CreateElement, params: any) => {
                let xuhao =
                    params.index +
                    (_.parseInt(pi.toString()) - 1) *
                        _.parseInt(this.videoData.pageSize!.toString()) +
                    1
                console.log("xuhao:", xuhao)
                return h("span", xuhao)
            }
        },

The document of

iview says that type:index can display the serial number, but when I click on the page, the value of the serial number does not increase. When I change it to type:index2, console.log can print the serial number, but it cannot be displayed on the page. Then I find that some of my other columns can not be displayed. Before, I can also make sure that the field name is not wrong.

Dec.01,2021

there are only four optional values for type, and api also says, "what the heck is your index2?"

if you want to customize adding numbers, you may need to customize a column.
is to add a

to columns.
{
   title:"",
   key:"number"
}

there should be a number attribute in the corresponding table tableData

[
  {
    number:1,
  }
]

you can use the id, returned to you by the backend or negotiate with the backend to add a numbered attribute, and then return it to you

Menu