У меня есть этот код скрипки JS. Я хочу создать предложения автозаполнения с использованием Vuejs. В настоящее время я достиг только частично, у меня есть проблема с предложениями. class = "lang-html prettyprint-override">
< /code>
#app {
.input {
position: relative;
}
#suggestion {
position: absolute;
left: 0;
}
}
< /code>
Vue Prototype Code < /p>
new Vue({
el: "#app",
data() {
return {
input: null,
t9: null,
words: []
}
},
mounted() {
this.init();
},
methods: {
init() {
axios({
method: 'GET',
url: 'https://raw.githubusercontent.com/napol ... aliane.txt'
}).then( (res) => {
this.words = res.data.split('\n');
this.t9 = Predictionary.instance();
this.t9.addWords(this.words);
});
},
predictWord() {
let suggestion;
this.countChars();
suggestion = this.t9.predict(this.input);
this.$refs.suggestion.innerText = suggestion[0];
},
countChars() {
console.log(this.input.length);
}
}
});
Подробнее здесь: https://stackoverflow.com/questions/675 ... user-digit