title: Vuejs - list - How to pass click functions as string
body: <p>I have an array of objects, each with a <code>click</code> property (a string) that is passed to a <code>click</code>-event handler. I can print the <code>.click</code> property to the console, but it is not recognized as Vue data. I tried to <code>eval(todo.click)</code>, but it didn't work.</p>
  
  <p><em>html:</em></p>
  
  <pre><code>&lt;div id="app"&gt;
    &lt;h2&gt;Todos:&lt;/h2&gt;
    &lt;ol&gt;
      &lt;li v-for="todo in todos"&gt;
        &lt;label @click="clickMethod(todo)"&gt;{{todo.text}}&lt;/label&gt;
      &lt;/li&gt;
    &lt;/ol&gt;
    &lt;br&gt;
    &lt;div v-if="infoVisible"&gt;infoVisible&lt;/div&gt;
    &lt;div v-if="tresVisible"&gt;tresVisible&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><em>and my js:</em></p>
  
  <pre><code>new Vue({
    el: "#app",
    data: {
      infoVisible:false,
      tresVisible:true,
      todos: [
        { text: "Learn JavaScript", done: false, click:'infoVisible=!infoVisible' },
        { text: "Learn Vue", done: false, click:'infoVisible=!infoVisible' },
        { text: "Play around in JSFiddle", done: true , click:'infoVisible=!infoVisible'},
        { text: "Build something awesome", done: true , click:'tresVisible=!tresVisible'}
      ]
    },
    methods: {
      clickMethod(todo){
        console.log(todo.click)
        todo.click()
      }
    }
  })
  </code></pre>
  
  <p><a href="https://jsfiddle.net/pflaho/ef97wn0q/3/" rel="nofollow noreferrer">Fiddle</a></p>