简体   繁体   中英

Show errors with alerts with vuejs

I want to show errors with alerts using bootstrap, how do I do with vuejs?

This is my code:

<div v-if="this.getError">
      <div v-for="(_errors, key) in this.getError">
        <p>{{key.replace('contract_data.','')}}</p>
        <ul>
          <li v-for="error in _errors">{{error}}</li>
        </ul>
      </div>
    </div>

And This is Json: https://i.stack.imgur.com/AkBmJ.png

Try to remove "this" keyword in your template. It causes some issues there, specially with v-for loops.

<div v-if="getError">
      <div v-for="(_errors, key) in getError">
        <p>{{key.replace('contract_data.','')}}</p>
        <ul>
          <li v-for="error in _errors">{{error}}</li>
        </ul>
      </div>
    </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM