中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
微信扫码分享
不多废话,直接上代码好吧 SaveButton().onClick(async (event:`ClickEvent`, result:`SaveButtonOnClickResult`) => { if (result == `SaveButtonOnClickResult`.SUCCESS) { try { const context = getContext(this); let helper = photoAccessHelper.getPhotoAccessHelper(context); let uri = await helper.createAsset(`photoAccessHelper.PhotoType.IMAGE`, 'png'); let file = await fileIo.open(uri, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); await fileIo.write(file.fd, "context"); await fileIo.close(file.fd); } catch (error) { console.error("error is " + `JSON.stringify(error)`); } } })