You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is my app.js code:
import mitt from 'mitt'
const emitter = mitt();
app.config.globalProperties.$bus = emitter;
Here is my ActionButton.vue code
<script>
export default {
props: ["data", "index",'showDelete'],
methods: {
getBasicDetails(id) {
this.$bus.emit("details", id);
},
deleteRecord(id) {
this.$swal
.fire({
title: "Are you sure?",
html: "You want to delete",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#60217D",
cancelButtonColor: "#d33",
confirmButtonText: "Yes",
})
.then((result) => {
if (result.value) {
this.$bus.emit("delete", id);
}
});
},
},
};
</script>
When we click on the edit button that time this.$bus.emit() event is not fire. can you please help me for the error occured.
You can use emit in the following ways:
File path:“src/utils/bus.js”
...JavaScript
import mitt from 'mitt'
const EventBus = mitt()
export default EventBus
...
Use path :"scr/view/use.vue"
...vue
<script setup>
import EventBus from "@/utils/bus";
EventBus.emit(message.name, message);
</script>
Activity
daydayup001001 commentedon May 28, 2024
You can use emit in the following ways:
File path:“src/utils/bus.js”
...JavaScript
import mitt from 'mitt'
const EventBus = mitt()
export default EventBus
...
Use path :"scr/view/use.vue"
<script setup> import EventBus from "@/utils/bus"; EventBus.emit(message.name, message); </script>...vue