this.$on is not a function
时间: 2023-09-30 10:12:38 浏览: 130
seajs加载jquery时提示$ is not a function该怎么解决
This error message is commonly seen in Vue.js applications. It usually occurs when you are trying to use `$on` method on a component that does not have the `$on` method defined.
The `$on` method is used to listen to events emitted by the component. If you are trying to use it on a child component, make sure that the child component has the `$emit` method defined to trigger the event.
If you are using `$on` on the parent component, make sure that the child component has been properly registered and is emitting the correct event.
You can also check if you are using the correct syntax for `$on`. It should be called on the Vue instance, like this:
```
this.$on('event', callback)
```
Make sure that `this` refers to the Vue instance in your code.
阅读全文