@kimsungkuk (patrick98@example.net) posted a new topic, subject "How to pass data to the parameters of the function?". It read:

   I am sorry for more than English is first.  
    We are talking through a translator.  
    
    
    Templates arr is three and repeated three object is created.  
    I want to and took over the parameters “1, 2 and 3 teststring” as there is a function called “testFunc” in each template.
    
    v-on:click=“testFunc('{{todo.text}}');” -> v-on:click=“testFunc(‘testString1');”  
    v-on:click=“testFunc('{{todo.text}}');” -> v-on:click=“testFunc(‘testString2');”  
    v-on:click=“testFunc('{{todo.text}}');” -> v-on:click=“testFunc(‘testString3');”

Then @eduardotavares (Eduardo Tavares) said

    Your code should be this way:
    [code] 
        <div v-for="todo in arr">
            <div v-on:click="testFunc(todo.text)">
                {{todo.text}}
            </div>
        </div>
        <script>
            new Vue({
                el: '#app',
                data: {
                    arr: [{text: "testeString1", data: "1"}, {text: "testeString2", data: "2"}, {text: "testeString3", data: "3"}]
                },
                methods: {
                    testFunc: function(text){
                         console.log(text)
                    }
                }
            });
        </script>
        
    [/code]

After which, @kimsungkuk (patrick98@example.net) added

    Thank you very much!


{'source': 'discourse', 'url': 'https://forum.vuejs.org/t/how-to-pass-data-to-the-parameters-of-the-function/3060', 'title': 'How to pass data to the parameters of the function?', 'views': 33536, 'has_accepted_answer': False, 'word_count': 148, 'like_count': 0, 'reply_count': 1, 'participant_count': 2, 'posts': 3, 'tags': '', 'author': '@kimsungkuk (sungkuk5420@gmail.com)', 'participants': '@kimsungkuk (sungkuk5420@gmail.com), @eduardotavares (Eduardo Tavares)', 'image_url': ['https://forum.vuejs.org/uploads/default/original/2X/1/1f7dbc8585bf9ae552d6d6fadd0a6520ca1c341b.JPG'], 'created_at': '2016-11-16T10:23:11.025Z', 'last_posted_at': '2016-11-16T12:45:11.891Z'}