Suppose there is a tag h5, we add a custom attribute value to it (which is added from dynamically)
Click the h5 tag to get the current corresponding custom attribute value?
I wrote this first as I took it for granted:
<h5 class="left t-title" @click='getDataId' :data-id=""></h5> <script> methods: { getDataId() { (-id); } }, </script>
Obviously, this won't get the value of data-id. . . .
This should be done:
<h5 class="left t-title" @click='getDataId()' :data-id=""></h5> <script> methods: { getDataId(id) { (id); } }, </script>
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.