thelounge/client/js/vue.js
Pavel Djundik 7e332b817d Channel list rendering with Vue
Co-Authored-By: Tim Miller-Williams <timmw@users.noreply.github.com>
2019-02-12 12:48:41 +02:00

39 lines
690 B
JavaScript

"use strict";
const Vue = require("vue").default;
const App = require("../components/App.vue").default;
const roundBadgeNumber = require("./libs/handlebars/roundBadgeNumber");
Vue.filter("roundBadgeNumber", roundBadgeNumber);
const vueApp = new Vue({
el: "#viewport",
data: {
appName: document.title,
activeChannel: null,
networks: [],
},
render(createElement) {
return createElement(App, {
props: this,
});
},
});
function findChannel(id) {
for (const network of vueApp.networks) {
for (const channel of network.channels) {
if (channel.id === id) {
return {network, channel};
}
}
}
return null;
}
module.exports = {
Vue,
vueApp,
findChannel,
};