UpyunImageFormater

UpyunImageFormater

又拍云图片格式化器类

Constructor

new UpyunImageFormater(options)

Source:

构造函数

Parameters:
Name Type Description
options object

配置选项见UpyunImageFormater.options

Members

(static, readonly) options :object

Source:
Since:
  • 2.1.0
Properties:
Name Type Attributes Default Description
name string 'upyun-image-formater'

打印器名称标记

debug boolean false

打印器调试模式是否开启

networkType function 'unknow'

网络制式类型

maxDPR number 3

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

draftRatio number 2

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

minWidth number global.document.documentElement.clientWidth
  • global.devicePixelRatio / 2 -
src string <nullable>

图片地址

format string <nullable>

图片格式

scale string 'both'

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

size string <nullable>

图片尺寸

quality number 90

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

otherRules string | object ''

又拍云图片处理的其他规则
默认值是(当前设备的物理分辨率 * 当前实际设备像素比的) 二分之一

默认配置选项

Type:
  • object

(readonly) $options :object

Source:
Since:
  • 2.1.0

实例初始配置项

Type:
  • object

(readonly) $originSrc :string

Source:
Since:
  • 2.1.0

获取实例的原图片地址

Type:
  • string

(readonly) $finalSrc :string

Source:
Since:
  • 2.1.0

获取实例的最终格式化后的图片地址

Type:
  • string

(readonly) $otherRules :object

Source:
Since:
  • 2.1.0

获取实例的其他规则项

Type:
  • object

(readonly) $DPR :number

Source:
Since:
  • 2.1.0

获取实例的格式化DPR规则

Type:
  • number

(readonly) $format :string

Source:
Since:
  • 2.1.0

获取实例的格式化类型规则

Type:
  • string

(readonly) $size :string

Source:
Since:
  • 2.1.0

获取实例的格式化尺寸规则

Type:
  • string

(readonly) $scale :string

Source:
Since:
  • 2.1.0

获取实例的格式化缩放规则

Type:
  • string

(readonly) $quality :number

Source:
Since:
  • 2.1.0

获取实例的格式化质量规则

Type:
  • number

Methods

(static) config(options) → {UpyunImageFormater}

Source:
Since:
  • 2.1.0
See:

更新默认配置选项

Parameters:
Name Type Description
options object

配置参数

Returns:
Type
UpyunImageFormater