最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can i change label "Sort by" in Vuetify's data table? - Stack Overflow

programmeradmin3浏览0评论

The label is visible only in the mobile view at the top of the v-data-table. I've read the documentation and there's no such a prop that can modify the "Sort by" label.

The label is visible only in the mobile view at the top of the v-data-table. I've read the documentation and there's no such a prop that can modify the "Sort by" label.

Share Improve this question edited Jun 4, 2020 at 9:52 Avinash Singh 5,3908 gold badges25 silver badges37 bronze badges asked Jun 4, 2020 at 9:48 frontrkfrontrk 534 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

We can easily do this by adding headerProps to the data option like:

new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  data () {
    return {
      headerProps: {
        sortByText: "Custom Sort By Text"
      },
      headers: [
        //...
      ],
      items: [
        //...
      ]  
    }
  },
})

and then updating the template like:

<v-data-table
  :headers="headers"
  :items="items"
  :items-per-page="5"
  class="elevation-1"
  :header-props="headerProps"
>      
</v-data-table>

Now, in mobile view instead of showing default "Sort by" label, it will show "Custom Sort By Text" and you can modify it as you need.

发布评论

评论列表(0)

  1. 暂无评论