'What does the @ symbol do in Vue.js?
I am new to Vue.js and I am looking at someone's code. I noticed they are using the @ symbol. What does this do and what is it used for?
export default {
methods: {
handleCreate() {
console.log('Child has been created.');
}
}
};
<template>
<ChildComponent @created="handleCreate" />
</template>
// ChildComponent
export default {
created() {
this.$emit('created');
}
}
Solution 1:[1]
In your case, the @ symbol, symbol is shorthand for v-on
.
It can also be used when importing to resolve things.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | kevin.groat |