How to do it...

In this recipe, you will build a filter for curse words for a hypothetical comment system. Suppose there's an article on our website that can potentially start a flame war:

<div id="app">   <h3>Who's better: Socrates or Plato?</h3>   <p>Technically, without Plato we wouldn't have<br>   much to go on when it comes to information about<br>   Socrates. Plato ftw!</p>

After that article, we place a comment box:

  <form>     <label>Write your comment:</label>     <textarea v-model="message"></textarea>     <button @click.prevent="submit">Send!</button>   </form>   <p>Server got: {{response}}</p> </div>

We also added a line after the form to debug the response that we will get from the server.

In our Vue instance, we write all the support code ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.