diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md b/zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md index c801a37b16339fafbfc682c031f80b84f5fb96a4..0b62429464cda6a3863da49396a3959f478d6365 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md @@ -48,20 +48,17 @@ createFormBindingData(obj?: Object | string): FormBindingData **示例:** ```ts -import featureAbility from '@ohos.ability.featureAbility'; -import fileio from '@ohos.fileio'; -let context=featureAbility.getContext(); -context.getOrCreateLocalDir((err,data)=>{ - let path=data+'/xxx.jpg'; - let fd = fileio.openSync(path); +import formBindingData from '@ohos.app.form.formBindingData'; +import fs from '@ohos.file.fs'; + +try { + let fd = fs.openSync('/path/to/form.png'); let obj = { 'temperature': '21°', - 'formImages': {'image': fd} + 'formImages': { 'image': fd } }; - try { - formBindingData.createFormBindingData(obj); - } catch (error) { - console.log(`catch err->${JSON.stringify(err)}`); - } -}) + formBindingData.createFormBindingData(obj); +} catch (error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} ``` \ No newline at end of file