Q:

How to update template on @click

Code
I have the following code. I want to update the results-box with a random selected choice. How would I update the template on a @click event.
<template>
  <div class="container">
    <button @click="getDecision()" class="ui primary button">Discover</button>
    <p id="results-box"></p>
  </div>
</template>

<script>
  export default {
    name: "SlapButton",
    data() {
      return {

      }
    },
    methods: {
      getDecision: function () {
        var decisions = [
          "choice 1",
          "choice 2",
          "choice 3",
          "choice 4",
          "choice 5",
          "choice 6"
        ]
        var randNum = Math.floor((Math.random() * decisions.length) + 0);
        var randChoice = decisions[randNum];
      }
    }
  }

</script>

Question
When the user clicks on the button getDecision() is called and it selects a random choice from the the decisions array. How do I display this random choice randChoice within the p tag #results-box.

A:

Here is a demo  and another micro example
Basically. You'll need a variable that will hold the randChoice once you define this variable inside data (){} object, just give it the value inside your method like this:
export default {
  name: "SlapButton",
  data() {
    return {
      randomChoice: false
    }
  },
  methods: {
    getDecision: function () {
      var decisions = [
        "choice 1",
        "choice 2",
        "choice 3",
        "choice 4",
        "choice 5",
        "choice 6"
      ]
      var randNum = Math.floor((Math.random() * decisions.length) + 0);
      this.randomChoice = decisions[randNum];
    }
  }
}

Now just show this data in your element like this:
<p id="results-box"> {{randomChoice}} </p>

