Google Picker Api JS显示没有文件夹的云端硬盘文件

时间:2018-10-09 11:49:39

标签: javascript google-picker

我想显示带文件夹的文件,下面功能的使用只是显示不带文件夹的文件列表。

// Create and render a Picker object for searching images.
function createPicker() {
  if (pickerApiLoaded && oauthToken) {
   var picker = new google.picker.PickerBuilder()
        .enableFeature(google.picker.Feature.NAV_HIDDEN)
        .enableFeature(google.picker.Feature.SUPPORT_TEAM_DRIVES)
        .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
        .setAppId(appId)
        .setOAuthToken(oauthToken)
        .addView(google.picker.ViewId.DOCS)
        .setDeveloperKey(developerKey)
        .setCallback(pickerCallback)
        .build();
     picker.setVisible(true);

  }
}

1 个答案:

答案 0 :(得分:0)

DocsView.setParent(string)方法设置要显示的初始父文件夹。这是一个示例tutorial,可能会有所帮助。另外,如对此SO post所述,请注意,您必须使用<div class="main-nav-bar"> <div class="scrollmenu"> <a href="#home">Home</a> <a href="#news">News</a> <a href="#contact">Contact</a> <a href="#about">About</a> <a href="#support">Support</a> <a href="#blog">Blog</a> <a href="#tools">Tools</a> <a href="#base">Base</a> <a href="#custom">Custom</a> <a href="#more">More</a> <a href="#logo">Logo</a> <a href="#friends">Friends</a> <a href="#partners">Partners</a> <a href="#people">People</a> <a href="#work">Work</a> </div> </div> setOAuthToken(oauthToken)在所有视图的选择器上设置oAuth令牌。