0

我正在为我的表使用 vue-good-table。我尝试使用降序对数据进行排序,firstSortTypeinitialSortBy它根本没有对表格进行排序。它总是按升序对表格进行排序。我的桌子看起来像这样

在此处输入图像描述

我试过firstSortType这样

  {
          label: "Tracking Number",
          field: "docket_no",

          sortable: true,
          firstSortType: "desc"
        },

初始排序依据

<vue-good-table

              :columns="tableColumns1"
              :rows="shipments"
              :line-numbers="true"

              :search-options="{
    enabled: true,
       placeholder: 'Type to search',
  }"

    :pagination-options="{
    enabled: true,
     mode: 'pages',
     
  }"

   :sort-options="{
enabled: true,
initialSortBy: [

  {field: 'docket_no', type: 'desc'}
],

}" />

当我尝试使用 initialSortBy 它向我显示此错误

TypeError: Cannot read property 'setInitialSort' of undefined
4

1 回答 1

0

经过大量研究,我能够通过添加 v-if 来解决这个问题,

<vue-good-table 
  v-if="rows && rows.length"
  :rows="rows"
...
于 2020-07-16T17:29:21.130 回答