寻求帮助调试我一直盯着 3 天的一些代码。它是 Vue.js / Laravel / Algolia。我觉得我的模型中某处有错误,但我看不到让它启动。有什么建议么?提前致谢。:
<input type="text" v-model="name" v-on:keyup="search" debounce="500">
<div id="results">
<article v-for="user in users">
<h2>@{{ user.name }}</h2>
</article>
</div>
和:
new Vue({
el: '#results',
data: {
query: '',
users: []
},
ready: function() {
this.client = algoliasearch('myKey', 'myKey');
this.index = this.client.initIndex('getstarted_actors');
},
methods: {
search: function() {
this.index.search(this.query, function(error, results) {
this.users = results.hits;
}.bind(this));
}
}
});