thelounge/client/components/InlineChannel.vue

31 lines
603 B
Vue
Raw Normal View History

2019-10-17 16:17:02 +02:00
<template>
<span class="inline-channel" dir="auto" role="button" tabindex="0" @click="onClick"
><slot></slot
></span>
</template>
<script>
2019-11-12 16:51:40 +01:00
const socket = require("../js/socket");
2019-10-17 16:17:02 +02:00
export default {
name: "InlineChannel",
props: {
channel: String,
},
methods: {
onClick() {
const existingChannel = this.$store.getters.findChannelOnCurrentNetwork(this.channel);
2019-10-17 16:17:02 +02:00
if (existingChannel) {
2019-10-25 23:37:40 +02:00
this.$root.switchToChannel(existingChannel);
2019-10-17 16:17:02 +02:00
}
socket.emit("input", {
target: this.$store.state.activeChannel.channel.id,
2019-10-17 16:17:02 +02:00
text: "/join " + this.channel,
});
},
},
};
</script>