0
爲什麼它抱怨這個錯誤?我正在實施activateMultiselect。打字稿 - 不執行抽象方法
非抽象類'RegionGetter'沒有實現從類'AreaGetter'繼承的 抽象成員'activateMultiselect'。
代碼:
abstract class AreaGetter implements iGetAreas {
_areasList: Array<string>;
_areas: KnockoutObservableArray<string>;
_selectedArea: KnockoutObservable<string>;
getAreas(geonameId){
var self = this;
self._areasList = [];
$.ajax({
url: `http://api.geonames.org/children?geonameId=${geonameId}&username=elion`
}).then(function(allAreasXML) {
var allAreasJSON = xml2json(allAreasXML);
var allAreas = JSON.parse(allAreasJSON);
if(allAreas.geonames.length) {
for (var index = 1; index < allAreas.geonames.length - 1; index++) {
self._areasList.push(allAreas.geonames[index].geoname);
}
} else {
if(allAreas.geonames) {
self._areasList.push(allAreas.geonames.geoname);
}
}
self._areas(self._areasList);
});
}
abstract activateMultiselect();
}
class RegionGetter extends AreaGetter {
_areasList = [];
_areas = ko.observableArray([]);
_selectedArea = ko.observable('');
activateMultiSelect() {
$("#region-select").multiselect({
buttonWidth: '100%',
buttonContainer: '<div style="height: 64px;" />',
buttonClass: 'none',
onChange: function(option, checked, select) {
alert('Changed option ' + $(option).val() + '.');
}
});
}
}
謝謝哈哈我的壞 – BeniaminoBaggins