Passthrough input ref

This commit is contained in:
Pavel Djundik 2018-07-09 21:53:49 +03:00 committed by Pavel Djundik
parent 2e3b95b9ed
commit f9d255b678
2 changed files with 3 additions and 3 deletions

View file

@ -67,7 +67,7 @@ export default {
}, },
mounted() { mounted() {
if (this.$root.settings.autocomplete) { if (this.$root.settings.autocomplete) {
require("../js/autocompletion").enable(); require("../js/autocompletion").enable(this.$refs.input);
} }
const inputTrap = Mousetrap(this.$refs.input); const inputTrap = Mousetrap(this.$refs.input);

View file

@ -172,12 +172,12 @@ const backgroundColorStrategy = {
index: 2, index: 2,
}; };
function enableAutocomplete() { function enableAutocomplete(inputRef) {
enabled = true; enabled = true;
let tabCount = 0; let tabCount = 0;
let lastMatch = ""; let lastMatch = "";
let currentMatches = []; let currentMatches = [];
input = $("#input"); input = $(inputRef);
input.on("input.tabcomplete", () => { input.on("input.tabcomplete", () => {
tabCount = 0; tabCount = 0;