app_appendFile 图片路径转自定义 base64 格式数据

return: Promise

使用指南

全局使用 (推荐)
  1. //main.jsimport Ctpic from '@/common/uni-app-customImg/custom-picture.js'; //文件路径请换成本地路径Vue.prototype.$Ctpic = new Ctpic(); //挂载到原型上
局部使用
  1. import Ctpic from '@/common/uni-app-customImg/custom-picture.js'; //文件路径请换成本地路径const ctpic = new Ctpic();let res=await ctpic.app_appendFile({ path:'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2919384842,1326281698&fm=11&gp=0.jpg', isNet:true})console.log(res);

代码演示

1.简单使用
  1. let res=await this.$Ctpic.app_appendFile({ path:'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2919384842,1326281698&fm=11&gp=0.jpg', isNet:true})console.log(res);
2.自定义 base64 图片格式
  1. let res=await this.$Ctpic.app_appendFile({ path:'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2919384842,1326281698&fm=11&gp=0.jpg', isNet:true, format:'png'})console.log(res);
2.转 base64 并压缩指定百分比
  1. let res=await this.$Ctpic.app_appendFile({ path:'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2919384842,1326281698&fm=11&gp=0.jpg', isNet:true, format:'png', compress:0.5, //压缩百分之50})console.log(res);

app_appendFile 参数

app_appendFile 返回参数