vuejs / Discussion

Vue.js discussion
167 stars 17 forks source link

@click not accepting prop #1310

Open K33k0 opened 7 years ago

K33k0 commented 7 years ago

Can someone shed some light on how to get the @click to accept a prop. I've been googling for about an hour without any success

Vue.component('submit', {
    props: ['id', 'text'],
    template: '<button :id="id" @click="id" >{{ text }}</button>',
    methods: {
            login: function(e){
                e.preventDefault()
                e.stopPropagation()
                let data = {
                    username: document.getElementById('username').value,
                    password: document.getElementById('password').value,
                    engineer: document.getElementById('engineer').value
                };
                console.log(data);
            }
    }
})