本文整理匯總了TypeScript中materialize-css.Autocomplete類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Autocomplete類的具體用法?TypeScript Autocomplete怎麽用?TypeScript Autocomplete使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Autocomplete類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
import * as M from "materialize-css";
import * as jQuery from "jquery";
// Test Component Initialization
// $ExpectType Autocomplete
M.Autocomplete.init(document.querySelector('.whatever')!);
// $ExpectType Autocomplete[]
M.Autocomplete.init(document.querySelectorAll('.whatever'));
// $ExpectType Autocomplete[]
M.Autocomplete.init(jQuery('.whatever'));
// $ExpectType Autocomplete[]
M.Autocomplete.init(cash('.whatever'));
示例2: onAutocomplete
// Autocomplete
// $ExpectType Autocomplete
new materialize.Autocomplete(elem);
// $ExpectType Autocomplete
const autocomplete = new materialize.Autocomplete(elem, {
data: {
Apple: null,
Google: "https://placehold.it/250x250"
},
minLength: 3,
onAutocomplete(text) {
// $ExpectType Autocomplete
this;
// $ExpectType string
text;
},
sortFunction(a, b, input) {
// $ExpectType string
a;
// $ExpectType string
b;
// $ExpectType string
input;
return 0;
}
});
// $ExpectType void
autocomplete.updateData({ Microsoft: null });
// $ExpectType void
autocomplete.destroy();
// $ExpectType AutocompleteOptions