Classes with string literals in Vue, HTML
P粉938936304
P粉938936304 2024-02-21 11:11:07
0
2
294

I want when I press the button to log in with a wrong password, the UI will show multiple alert popups instead of one because the user doesn't know if they still entered the wrong password.

So I use counter and string literal like this

<!-- mt = margin-top, so each alert won't lie on each other -->
<v-alert
  v-for="i in counter"
  :key="i"
  class=`mt-${i}` 
>
  Wrong Password
</v-alert>

This doesn't work. Any other ideas?

P粉938936304
P粉938936304

reply all(2)
P粉506963842

You can bind classes -> :class="'mt-${i}'" tildas ` should only be around ${i} and around the whole name 'mt-yourcode' Use apostrophe

P粉576184933

This should work:


  Wrong Password

View this example

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!