How does vue.js get the text content in the table td element?

                <td id="er" ref="td">
                    {{item.username}}
                    <a style="float:right;color:DarkGray;font-size:13px" v-show="showdelete"></a>
                </td>
                
                

traverses the data in the background, and the user name in td is the obtained user name. I want to realize the hidden reality delete button by judging whether the user name stored in cookie is equal to the user name in td. To achieve the ability to delete dynamic.
then how to get the user name in this td.

clipboard.png

Nov.14,2021

simple, the showdelete in v-show is changed into a method, and the item.username is passed in


2 schemes:

  • combine document.getElementById ('er'). InnerText; ) to do it;
  • user name of the index corresponding to the data cache

<td id="er" ref='td'>
    {{item.username}}
    <a style="float:right;color:DarkGray;font-size:13px" v-show="showdelete" @click="del()"></a>
</td>

del(){
    console.log(this.$ref.td)
}

in this way, the dom node td can be selected

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-1b3bb74-2bb0b.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-1b3bb74-2bb0b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?