本文整理汇总了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