0

I have three columns in a table, but I would like to display the third column only if the user logged in is a user with an administrator profile.

<b-table id="my-table" hover striped small outlined :items="values" :fields="fields" class="mt-0 mb-0">
    <template slot="actions" slot-scope="data">
        <b-button variant="info" @click="viewMessage(data.item)" class="mr-2" size="sm">
            <i class="fa fa-envelope-open"> Show</i>
        </b-button>
    </template>
</b-table>

fields: [
    { key: 'from', label: 'From', sortable: true },
    { key: 'to', label: 'To', sortable: true },
    { key: 'readTo', label: 'Lida', sortable: true,
        formatter: value => value ? 'Yes' : 'No' },
]

The "readTo" column will be displayed only if the user is an administrator.

rufus05
  • 43
  • 1
  • 10

0 Answers0