How can vue tell if the current user can see this button?

I"m going to do this function now

clipboard.png

after each login, the backend will return the permissions of the current user to me:

"permissions": [
    "account:update",
    "account:list",
    "account:findById",
    "adveradvertiser:add"
],

I will store this data in localStore. With this "create advertiser" button, I will show it and hide it according to whether the data sent to me at the back end contains "adveradvertiser:add".

the first thing I think of is v-if, but here I don"t know how to iterate whether the permissions array contains adveradvertiser:add

<button class="btnYellow" v-if=""></button>

you don't have to store permissions in the cache, just put them in data
js

data() {
      return {
          permissions: [
                "account:update",
                "account:list",
                "account:findById",
                "adveradvertiser:add"
            ],
      }
}

html

v-if="permissions.indexOf('adveradvertiser:add') > 0?true:false "

js

data() {
      return {
          permissions: [
                "account:update",
                "account:list",
                "account:findById",
                "adveradvertiser:add"
            ],
      }
}

html

 v-if="permissions.some(p=>p==='adveradvertiser:add')"

write a method to determine whether the array contains the string adveradvertiser:add.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a08d-2c1f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a08d-2c1f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?