欢迎光临
我们一直在努力

九八云百度小程序教程:swan.removeSavedFile

  • swan.removeSavedFile
    • 方法参数
      • object 参数说明
    • 示例
      • 图片示例
      • 代码示例
    • 错误码
      • Android
      • iOS

    swan.removeSavedFile

    解释:删除本地存储的文件
    Web 态说明: 受浏览器限制,Web 态不支持文件系统相关功能,调用该方法会执行失败回调函数。

    方法参数

    Object object

    object 参数说明

    属性名 类型 必填 默认值 说明

    filePath

    String

    需要删除的文件路径

    success

    Function

    接口调用成功的回调函数

    fail

    Function

    接口调用失败的回调函数

    complete

    Function

    接口调用结束的回调函数(调用成功、失败都会执行)

    示例

    跳转编辑工具

    在开发者工具中打开

    在 WEB IDE 中打开

    扫码体验

    代码示例

    请使用百度APP扫码

    图片示例

    代码示例

    • SWAN
    • JS
    
     
    1. <view class="wrap">
    2. <view class="card-area">
    3. <view class="display-area">
    4. <image class="display-area-image" src="https://b.bdstatic.com/searchbox/icms/searchbox/img/file-pdf.png" mode="widthFix"></image>
    5. <view class="title">示例文件.pdf</view>
    6. </view>
    7. <button type="primary" bindtap="saveFile">保存文件</button>
    8. <button type="primary" bindtap="getSavedFileList">获取已保存文件列表信息</button>
    9. <button type="primary" bindtap="deleteFile">删除已保存文件</button>
    10. </view>
    11. </view>

    错误码

    Android

    错误码 说明

    202

    解析失败,请检查参数是否正确

    1001

    执行失败

    2000

    文件路径无效

    2001

    文件不存在

    2002

    文件过大

    2004

    文件删除失败

    iOS

    错误码 说明

    202

    解析失败,请检查参数是否正确

    2001

    文件不存在

    2004

    文件删除失败

    未经允许不得转载:九八云安全 » 九八云百度小程序教程:swan.removeSavedFile