未验证 提交 e1e813ca 编写于 作者: O openharmony_ci 提交者: Gitee

!7050 更新fileio的path获取接口文档

Merge pull request !7050 from 潘钦旭/master
......@@ -17,15 +17,31 @@ import fileio from '@ohos.fileio';
使用该功能模块对文件/目录进行操作前,需要先获取其应用沙箱路径,获取方式及其接口用法请参考:
**Stage模型**
```js
import Ability from '@ohos.application.Ability';
class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
let context = this.context;
let path = context.filesDir;
}
}
```
Stage模型context的具体获取方法参见[Stage模型](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-ability-context.md#abilitycontext)
**FA模型**
```js
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
let path = '';
context.getFilesDir().then((data) => {
path = data;
let path = data;
})
```
FA模型context的具体获取方法参见[FA模型](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-Context.md#context%E6%A8%A1%E5%9D%97)
## fileio.stat
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册