Metoda PickerBuilder.setSelectableMimeTypes
Ustaw listę typów MIME, które można wybrać. Jeśli wymagane są 2 lub więcej typów MIME, rozdziel je przecinkami. Jeśli nie ustawisz typów MIME, w widoku będą wyświetlane pliki wszystkich typów MIME.
Przykłady
Podstawowe użycie z wieloma typami MIME
const mimeTypes = ['image/png', 'image/jpeg'];
const builder = new google.pickerPickerBuilder()
.setSelectableMimeTypes(mimeTypes.join(','));
Typy MIME w Google Workspace
const mimeTypes = [
'application/vnd.google-apps.document',
'application/vnd.google-apps.presentation',
'application/vnd.google-apps.spreadsheet',
];
const builder = new google.pickerPickerBuilder()
.setSelectableMimeTypes(mimeTypes.join(','));
Podpis
setSelectableMimeTypes(type: string): PickerBuilder;
Szczegóły
Opcjonalnie |
Nie |
Finał |
Nie |
Chroniony |
Nie |
Statyczny |
Nie |
Parametry
Nazwa |
Typ |
Opcjonalnie |
Opis |
type |
string |
Nie |
|
Zwroty
PickerBuilder
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-10-15 UTC.
[null,null,["Ostatnia aktualizacja: 2024-10-15 UTC."],[[["Defines the accepted file types for display in the Google Picker view."],["Uses a comma-separated string of MIME types to specify allowed file formats."],["If no MIME types are set, all file types will be visible."],["Provides examples for basic usage and Google Workspace specific MIME types."],["Returns a PickerBuilder object for chaining further configurations."]]],["The `setSelectableMimeTypes` method, part of `PickerBuilder`, filters selectable file types. It takes a comma-separated string of MIME types as input. If no MIME types are specified, all file types are selectable. Examples show usage with image types and Google Workspace types. This method, which is not optional, final, protected or static, returns a `PickerBuilder` object, and it is necessary to input a string value.\n"]]