我是 Vue.js 的新手,我正在查看某人的代码。我注意到他们正在使用@符号。这是做什么用的?
export default {
methods: {
handleCreate() {
console.log('Child has been created.');
}
}
};
<template>
<ChildComponent @created="handleCreate" />
</template>
// ChildComponent
export default {
created() {
this.$emit('created');
}
}
在你的情况下,@符号,符号是简写v-on https://vuejs.org/api/built-in-directives.html#v-on。
导入时也可以使用它来解决问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)