Use global Vue calls instead of vueApp reference

This commit is contained in:
Pavel Djundik 2019-11-11 23:39:09 +02:00
parent f2309c7c89
commit 91e0349486
4 changed files with 13 additions and 8 deletions

View File

@ -1,12 +1,13 @@
"use strict";
import Vue from "vue";
const $ = require("jquery");
const socket = require("./socket");
const utils = require("./utils");
const ContextMenu = require("./contextMenu");
const contextMenuActions = [];
const contextMenuItems = [];
const {vueApp} = require("./vue");
const {switchToChannel, navigate} = require("./router");
const store = require("./store").default;
@ -327,7 +328,7 @@ function addEditTopicItem() {
store.getters.findChannel(Number(itemData)).channel.editTopic = true;
document.querySelector(`#sidebar .chan[data-id="${Number(itemData)}"]`).click();
vueApp.$nextTick(() => {
Vue.nextTick(() => {
document.querySelector(`#chan-${Number(itemData)} .topic-input`).focus();
});
}

View File

@ -1,7 +1,8 @@
"use strict";
import Vue from "vue";
const socket = require("../socket");
const {vueApp} = require("../vue");
const store = require("../store").default;
socket.on("more", function(data) {
@ -15,7 +16,7 @@ socket.on("more", function(data) {
data.totalMessages > channel.channel.messages.length + data.messages.length;
channel.channel.messages.unshift(...data.messages);
vueApp.$nextTick(() => {
Vue.nextTick(() => {
channel.channel.historyLoading = false;
});
});

View File

@ -1,7 +1,8 @@
"use strict";
import Vue from "vue";
const socket = require("../socket");
const {vueApp} = require("../vue");
const store = require("../store").default;
socket.on("msg:preview", function(data) {
@ -15,6 +16,6 @@ socket.on("msg:preview", function(data) {
const previewIndex = message.previews.findIndex((m) => m.link === data.preview.link);
if (previewIndex > -1) {
vueApp.$set(message.previews, previewIndex, data.preview);
Vue.set(message.previews, previewIndex, data.preview);
}
});

View File

@ -1,7 +1,9 @@
"use strict";
import Vue from "vue";
const socket = require("../socket");
const {vueApp, initChannel} = require("../vue");
const {initChannel} = require("../vue");
const store = require("../store").default;
const {switchToChannel} = require("../router");
@ -58,6 +60,6 @@ socket.on("network:info", function(data) {
}
for (const key in data) {
vueApp.$set(network, key, data[key]);
Vue.set(network, key, data[key]);
}
});