HarmonyOS DocumentViewPicker有没有完整的示例

DocumentViewPicker有没有完整的示例,没看明白源文件如何设置。

HarmonyOS
2024-08-04 14:20:03
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
sslijun

请参考:

async function example07() { 
  try { 
    let DocumentSelectOptions = new picker.DocumentSelectOptions(); 
    let documentPicker = new picker.DocumentViewPicker(); 
    documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult: Array<string>) => { 
      console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); 
    }).catch((err: BusinessError) => { 
      console.error('DocumentViewPicker.select failed with err: ' + JSON.stringify(err)); 
    }); 
  } catch (error) { 
    let err: BusinessError = error as BusinessError; 
    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err)); 
  } 
} 
 
 
async function example08() { 
  try { 
    let DocumentSelectOptions = new picker.DocumentSelectOptions(); 
    let documentPicker = new picker.DocumentViewPicker(); 
    documentPicker.select(DocumentSelectOptions, (err: BusinessError, DocumentSelectResult: Array<string>) => { 
      if (err) { 
        console.error('DocumentViewPicker.select failed with err: ' + JSON.stringify(err)); 
        return; 
      } 
      console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); 
    }); 
  } catch (error) { 
    let err: BusinessError = error as BusinessError; 
    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err)); 
  } 
} 
 
async function example09() { 
  try { 
    let documentPicker = new picker.DocumentViewPicker(); 
    documentPicker.select((err: BusinessError, DocumentSelectResult: Array<string>) => { 
      if (err) { 
        console.error('DocumentViewPicker.select failed with err: ' + JSON.stringify(err)); 
        return; 
      } 
      console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); 
    }); 
  } catch (error) { 
    let err: BusinessError = error as BusinessError; 
    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err)); 
  } 
} 
 
async function example10() { 
  try { 
    let DocumentSaveOptions = new picker.DocumentSaveOptions(); 
    DocumentSaveOptions.newFileNames = ['DocumentViewPicker01.txt']; 
    let documentPicker = new picker.DocumentViewPicker(); 
    documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult: Array<string>) => { 
      console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); 
    }).catch((err: BusinessError) => { 
      console.error('DocumentViewPicker.save failed with err: ' + JSON.stringify(err)); 
    }); 
  } catch (error) { 
    let err: BusinessError = error as BusinessError; 
    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err)); 
  } 
} 
 
 
async function example11() { 
  try { 
    let DocumentSaveOptions = new picker.DocumentSaveOptions(); 
    DocumentSaveOptions.newFileNames = ['DocumentViewPicker02.txt']; 
    let documentPicker = new picker.DocumentViewPicker(); 
    documentPicker.save(DocumentSaveOptions, (err: BusinessError, DocumentSaveResult: Array<string>) => { 
      if (err) { 
        console.error('DocumentViewPicker.save failed with err: ' + JSON.stringify(err)); 
        return; 
      } 
      console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); 
    }); 
  } catch (error) { 
    let err: BusinessError = error as BusinessError; 
    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err)); 
  } 
} 
 
async function example12() { 
  try { 
    let documentPicker = new picker.DocumentViewPicker(); 
    documentPicker.save((err: BusinessError, DocumentSaveResult: Array<string>) => { 
      if (err) { 
        console.error('DocumentViewPicker.save failed with err: ' + JSON.stringify(err)); 
        return; 
      } 
      console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); 
    }); 
  } catch (error) { 
    let err: BusinessError = error as BusinessError; 
    console.error('DocumentViewPicke')
分享
微博
QQ
微信
回复
2024-08-05 12:00:57
相关问题
HarmonyOS 有没有图片取色API ?
107浏览 • 1回复 待解决
HarmonyOS 有没有密码控件?
218浏览 • 1回复 待解决
HarmonyOS 有没有类似scrollview组件
198浏览 • 1回复 待解决
HarmonyOS 有没有URLEncoder组件?
244浏览 • 2回复 待解决
HarmonyOS 有没有图表组件
211浏览 • 1回复 待解决
HarmonyOS ArkTS 有没有extension
296浏览 • 1回复 待解决
HarmonyOS 有没有活体检测SDK?
67浏览 • 1回复 待解决
HarmonyOS 有没有指纹登录功能?
38浏览 • 1回复 待解决
HarmonyOS APP有没有清除缓存接口
321浏览 • 1回复 待解决
HarmonyOS 有没有蓝牙,NFC相关DEMO
238浏览 • 1回复 待解决