0
votes
<template>
    <div class="test">
        <h1>か</h1>

        <input type="text" v-model="userIn" v-on:keyup.enter="enterHit" id="tboxInput">
        <button v-on:click="enterHit()">Next</button>
    </div>

</template>

<script>
    export default {
        name: 'test',
        data() {
            return {
                title: 'Hello World',
                userIn: "",
                user: {
                    firstName: 'Taco',
                    lastName: 'Bell'
                }
            }
        },

        methods: {
            enterHit: function(){
                //validate
                console.log("test");
            }
        }
    }
</script>

<style scoped>

</style>

New to Vue.js. Testing out v-on:keyup.enter functionality. Console in Firefox giving me an error:

[Vue warn]: Property or method "enterHit" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

TypeError: _vm.enterHit is not a function

Test.vue component is being imported into my main App.vue, for reference.

1
think this is going wrong elsewhere, this code works ok... see jsfiddle.net/h8a0o2j6Keith Nicholas

1 Answers

0
votes

Turns out the browser needed to be refreshed manually after I made those method additions. I was relying on the dev server (npm run dev) to update the page.