Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions dist/vue-typeahead.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
exports.default = {
data: function data() {
return {
queries: [],
items: [],
query: '',
current: -1,
Expand Down Expand Up @@ -60,21 +61,35 @@ exports.default = {
}

this.loading = true;

this.queries.push(this.query);

this.fetch().then(function (response) {
if (response && _this.query) {
var data = response.data;
data = _this.prepareResponseData ? _this.prepareResponseData(data) : data;
_this.items = _this.limit ? data.slice(0, _this.limit) : data;
_this.current = -1;
_this.loading = false;

if (_this.selectFirst) {
_this.down();
}
}
});
setTimeout(function(_this2) {
var param = _this2.queries.shift();
if (_this2.queries.length == 0)
_this2.callFetch()
}, 1000, this);

},

callFetch: function callFetch(){
var _this = this;

this.fetch().then(function (response) {
if (response && _this.query) {
var data = response.data;
data = _this.prepareResponseData ? _this.prepareResponseData(data) : data;
_this.items = _this.limit ? data.slice(0, _this.limit) : data;
_this.current = -1;
_this.loading = false;

if (_this.selectFirst) {
_this.down();
}
}
});
},

fetch: function fetch() {
var _this2 = this;

Expand Down