方法 PickerBuilder.setSelectableMimeTypes
設定可選取的 MIME 類型清單。如果需要多個 MIME 類型,請使用半形逗號分隔。如果您不設定 MIME 類型,則系統會將
所有 MIME 類型都會顯示在檢視畫面中。
範例
多種 MIME 類型的基本用法
const mimeTypes = ['image/png', 'image/jpeg'];
const builder = new google.pickerPickerBuilder()
.setSelectableMimeTypes(mimeTypes.join(','));
Google Workspace MIME 類型
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(','));
簽名
setSelectableMimeTypes(type: string): PickerBuilder;
詳細資料
參數
名稱 |
類型 |
選用 |
說明 |
type |
string |
否 |
|
傳回
PickerBuilder
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-10-14 (世界標準時間)。
[null,null,["上次更新時間:2024-10-14 (世界標準時間)。"],[[["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"]]