0
我公司的一位前任開發人員寫了一個Vue.js typeahead組件,一切似乎都很好,直到我進入Internet Explorer 11爲止。當輸入一個有keyup
函數綁定到它的輸入時有時不接受用戶輸入的字符。這似乎是我正在使用的代碼的性能問題。下面是導致問題的代碼,如果我將其全部刪除,並且不做任何輸入沒有問題。我可以提出哪些性能建議來加速它?Vue組件差的IE性能
searchResults: function(e){
this.isShown = true
this.selectedIndex = 0
this.filterOptions()
if(this.wildcardSearch){
var searchObj = {}
searchObj[this.displayProp] = 'Search For: <strong>'+this.search+'</strong>'
this.matches.unshift(searchObj)
}
// Show first 5 results
this.matches = this.matches.splice(0,5)
},
filterOptions: function(){
var lowSearch = this.search.toLowerCase()
var that = this
if (this.search) // don't filter on empty string
this.matches = this.options.map(function(o){
if (o[that.displayProp].toLowerCase().indexOf(lowSearch) > -1)
return o
}).filter(function(o){return o})
},
我沒有回答,但是您是否嘗試過更改事件以測試是否有助於使用「@ input」事件? –