From 9f735502acd9410182b5ae7746243f008e1fd6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BA=86=E6=B3=89?= Date: Sun, 20 Nov 2022 13:46:03 +0800 Subject: [PATCH] Update uts-plugin.md --- docs/plugin/uts-plugin.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/plugin/uts-plugin.md b/docs/plugin/uts-plugin.md index 9d5fa3023..c0f20873f 100644 --- a/docs/plugin/uts-plugin.md +++ b/docs/plugin/uts-plugin.md @@ -451,6 +451,22 @@ import * as UTSHello from "../../../uni_modules/uts-osapi"; UTSHello.getBatteryCapacity() ``` +**特别注意** + +需要特别注意的是,import UTS插件时,只能到插件的根目录,不能直接引入到最终的文件 + +``` +// 正确的写法 +import * as UTSHello from "../../../uni_modules/uts-osapi"; + +``` +``` +// 错误的写法 +import * as UTSHello from "../../../uni_modules/uts-osapi/index.uts"; + +``` + + **显性引用** @@ -466,6 +482,8 @@ import { getBatteryCapacity() ``` + + 关于电量这个插件,插件市场已经提供好了现成的插件,除了Android,还同时支持了web和小程序,可以去下载体验。[详见](https://ext.dcloud.net.cn/plugin?id=9295) 更多开发示例,可以参考 [HelloUTS](https://gitcode.net/dcloud/hello-uts)。 -- GitLab