feat: avatar add srcSet
parent
8eaf6da73a
commit
43a503fc9e
|
@ -19,6 +19,8 @@ export default {
|
||||||
default: 'default',
|
default: 'default',
|
||||||
},
|
},
|
||||||
src: String,
|
src: String,
|
||||||
|
/** Srcset of image avatar */
|
||||||
|
srcSet: String,
|
||||||
icon: String,
|
icon: String,
|
||||||
alt: String,
|
alt: String,
|
||||||
loadError: Function,
|
loadError: Function,
|
||||||
|
@ -71,7 +73,7 @@ export default {
|
||||||
},
|
},
|
||||||
render () {
|
render () {
|
||||||
const {
|
const {
|
||||||
prefixCls, shape, size, src, icon, alt,
|
prefixCls, shape, size, src, icon, alt, srcSet,
|
||||||
} = this.$props
|
} = this.$props
|
||||||
|
|
||||||
const { isImgExist, scale } = this.$data
|
const { isImgExist, scale } = this.$data
|
||||||
|
@ -101,6 +103,7 @@ export default {
|
||||||
children = (
|
children = (
|
||||||
<img
|
<img
|
||||||
src={src}
|
src={src}
|
||||||
|
srcSet={srcSet}
|
||||||
onError={this.handleImgLoadError}
|
onError={this.handleImgLoadError}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
| shape | the shape of avatar | `circle` \| `square` | `circle` |
|
| shape | the shape of avatar | `circle` \| `square` | `circle` |
|
||||||
| size | the size of the avatar | number \| string: `large` `small` `default` | `default` |
|
| size | the size of the avatar | number \| string: `large` `small` `default` | `default` |
|
||||||
| src | the address of the image for an image avatar | string | - |
|
| src | the address of the image for an image avatar | string | - |
|
||||||
|
| srcSet | a list of sources to use for different screen resolutions | string | - |
|
||||||
| alt | This attribute defines the alternative text describing the image | string | - |
|
| alt | This attribute defines the alternative text describing the image | string | - |
|
||||||
| loadError | handler when img load error,return false to prevent default fallback behavior | () => boolean | - |
|
| loadError | handler when img load error,return false to prevent default fallback behavior | () => boolean | - |
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
| shape | 指定头像的形状 | Enum{ 'circle', 'square' } | `circle` |
|
| shape | 指定头像的形状 | Enum{ 'circle', 'square' } | `circle` |
|
||||||
| size | 设置头像的大小 | number \| Enum{ 'large', 'small', 'default' } | `default` |
|
| size | 设置头像的大小 | number \| Enum{ 'large', 'small', 'default' } | `default` |
|
||||||
| src | 图片类头像的资源地址 | string | - |
|
| src | 图片类头像的资源地址 | string | - |
|
||||||
|
| srcSet | 设置图片类头像响应式资源地址 | string | - |
|
||||||
| alt | 图像无法显示时的替代文本 | string | - |
|
| alt | 图像无法显示时的替代文本 | string | - |
|
||||||
| loadError | 图片加载失败的事件,返回 false 会关闭组件默认的 fallback 行为 | () => boolean | - |
|
| loadError | 图片加载失败的事件,返回 false 会关闭组件默认的 fallback 行为 | () => boolean | - |
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue