方法 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
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-10-15。
[null,null,["最后更新时间 (UTC):2024-10-15。"],[[["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"]]