1
我已经在Vue.js 1.0.21中定义了一个方法,并且在尝试使用它时收到以下错误。 我正在使用CLI版本,因此语法与我习惯的语法稍有不同。VueJS:scope.notifications不是函数
错误
TypeError: scope.notifications is not a function. (In 'scope.notifications()', 'scope.notifications' is undefined)
Navbar.vue
<template>
<div id="navbar">
<!-- ... -->
<a href="#data" @click.prevent="notifications()"><i class="fa fa-bell-o"></i></a>
<!-- ... -->
</div> <!-- /navbar -->
</template>
<script>
export default {
data() {
return {
versionIsVisible: false,
version: '2.0.0'
};
},
methods() {
return {
notifications: function() {
console.log('Notifications');
}
};
}
};
</script>
<style lang="scss" scoped>
@import '../assets/sass/settings';
// ...
</style>