docs: 插件开发指南新增 pickPath() 便捷调用说明
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -5161,7 +5161,25 @@ window.addEventListener('message', function(e) {
|
||||
|
||||
选择器关闭时通过 postMessage 返回: {"action":"fm-picked","path":"/选择的/路径"}
|
||||
|
||||
#### 8.1.3 后端 REST API 参考
|
||||
#### 8.1.3 便捷调用: window.pickPath (v0.6.0 新增)
|
||||
|
||||
SenSu WebUI 提供全局函数 pickPath(),任何页面可直接调用唤出文件选择器:
|
||||
|
||||
```html
|
||||
<!-- 选择目录 -->
|
||||
<button onclick="pickPath('dir', function(path) {
|
||||
document.getElementById('work-dir').value = path;
|
||||
})">📁 选择目录</button>
|
||||
|
||||
<!-- 选择文件 -->
|
||||
<button onclick="pickPath('file', function(path) {
|
||||
document.getElementById('config-file').value = path;
|
||||
})">📄 选择文件</button>
|
||||
```
|
||||
|
||||
无需手动管理 postMessage,回调直接拿到路径字符串。适用于项目管理、配置页面等任何需要路径选择的场景。
|
||||
|
||||
#### 8.1.4 后端 REST API 参考
|
||||
|
||||
插件后端可直接调用文件管理 API(需声明对应权限):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user