[Vuejs]-VUETIFY DataTable – How to use v-if on table header to hide certain column from users

0πŸ‘

βœ…

It should work like this:

data() {
  return {
    headersData: [
      { text: "Code", value: "document_control_code" },
      { text: "Request Type", value:  "request_type"} ,
      { text: "Title", value: "document_title" },
      { text: "department", value: "department" },
      { text: "Request Date", value: "request_date" },
      { text: "Due Date", value: "due_date" },
   ]
  }
},

and in mounted()

mounted() {
  if(admin) {
    this.headersData.push({ text: "Action", value: "action" });
  }
}


 

Leave a comment