https://github.com/kytrun/webdav-client-uniapp
Fork 自 webdav-client,添加了 uni.request 作为 axios adaper,目前基本可用,没有测试全部功能。需要注意的是坚果云提供的 WebDAV 并非标准的 WebDAV,部分接口有问题可能在其他服务上表现正常。
下载 https://github.com/kytrun/webdav-client-uniapp/blob/master/dist/uniapp/webdav.js 文件在 uni-app 项目中以 ES module 导入使用。
坚果云 WebDAV 示例:
import {
AuthType,
createClient
} from "@/deps/webdav"
const client = createClient(
"https://dav.jianguoyun.com/dav/test/", {
authType: AuthType.Password,
username: `${username}`,
password: `${password}`
})
client.getFileContents("test.txt", {
format: "text"
})
.then(data => console.log(data))
.catch(e => console.log(e))
更多接口见项目文档。
0 个评论
要回复文章请先登录或注册