0

Im following Jeffery's vue-series to learn how to impelement vue.js into my projects. Im understanding the basics however Im having a problem with the v-on attribute. For some reason I can't get any of my methods to run on blur click or whatever. Jeffery is using the "" brackets in the video yet in the documentation they use it without. I've tried both and couldn't even get it to log on the console. Here is my setup.

HTML:

<div id = "demo" class = "container">

    <ul>
        <li v-for = "name in names">@{{ name }}</li>
    </ul>

    <input type="text" placeholder="Add new name" v-model = "newName" v-on="blur:addName">

</div>

vue.js

new Vue({

    el: '#demo',

    data: {
        names: ['Ricki', 'Kevin', "James"]
    },


    methods: {

        addName: function() {

            console.log('working');

        }
    }


});

1 Answer 1

3

The v-on syntax has changed. Try this instead

<input type="text" placeholder="Add new name" v-model = "newName" v-on:blur="addName">
Sign up to request clarification or add additional context in comments.

1 Comment

You're right. I was watching the old lessons. He has come out with a updated videos, Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.