Global

Methods

install(Vue, options)

Source:
Since:
  • 2.0.0

又拍云图片处理工具注册函数
处理规则请参考又拍云文档

若想针对某个值使用默认值,则传入null值即可

Parameters:
Name Type Default Description
Vue Vue

Vue类

options object {}

配置选项

Properties
Name Type Attributes Default Description
debug boolean <optional>
false

是否开启日志调试模式

maxDPR number <optional>
3

(>=4)g网络或者'unknow'未知网络下,DPR取值的最大数

draftRatio number <optional>
2

UI设计稿尺寸与设备物理尺寸的比例

networkHandler function <optional>
()=>{'unknow'}

获取网络制式的处理函数,若不存在,返回unknow

minWidth number <optional>
global.document.documentElement.clientWidth * global.devicePixelRatio / 2

默认值是(当前设备的物理分辨率 * 当前实际设备像素比的) 二分之一

scale string <optional>
'both'

又拍云图片尺寸缩放方式,默认宽度进行自适应,超出尺寸进行裁剪,若自定义尺寸大于原尺寸时,自动缩放至指定尺寸再裁剪

quality number <optional>
90

又拍云jpg格式图片压缩质量

rules string | object <optional>
''

(deprecated 使用otherRules代替)又拍云图片处理的其他规则

otherRules string | object <optional>
''

又拍云图片处理的其他规则

image-format(src, sizeOrConfigopt, scaleopt, nullable, formatopt, nullable, qualityopt, nullable, otherRulesopt) → {string}

Source:
Since:
  • 2.0.0

vue过滤器:image-format

Parameters:
Name Type Attributes Default Description
src string

图片地址,第一个参数vue组件会自动传入,无须管理

sizeOrConfig number | string | object <optional>

裁剪尺寸,取设计稿中的尺寸即可,该值如果是一个字典格式的配置对象,则会其他参数选项的值

scale string <optional>
<nullable>
'both'

缩放方式

format string <optional>
<nullable>

图片格式化,系统会根据多种情况来最终确定该值的默认值

quality number <optional>
<nullable>
90

若输出jpg格式图片时的压缩质量

otherRules string | object <optional>
''

又拍云图片处理的的其他规则,注意,如果它是一个字符串格式是,那么它必须是采用/[key]/[value]这样的写法,不能随意乱写,同时这里的值不会覆盖前几个参数的值,该项的优先级最低

Returns:
Type
string

(async) checkWebpFeatures(feature) → {Promise}

Source:
Since:
  • 1.0.0

检测webp特性的支持程度

Parameters:
Name Type Description
feature string

特性值

Returns:
Type
Promise