Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ajvanho's avatar
Level 14

Uncaught TypeError: Cannot read properties of undefined (reading '$refs')

//template
<input :ref="input" type="number" v-model="data" class="w-12 h-6 rounded-lg">
<button @click="action" type="button">edit</button>
//script
function action () {
            console.log(this.$refs.input)
 }
0 likes
3 replies
vincent15000's avatar

@Ajvanho Have you tried to use the same expression in the mounted() method to check if it works. For example with the same example as in the documentation.

Please or to participate in this conversation.