康巴易测肤/伤疤uniapp小程序类
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 개월 전
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <uvImage
  3. :src="src"
  4. :mode="mode"
  5. :width="width"
  6. :height="height"
  7. :shape="shape"
  8. :radius="radius"
  9. :lazyLoad="lazyLoad"
  10. :showMenuByLongpress="showMenuByLongpress"
  11. :loadingIcon="loadingIcon"
  12. :errorIcon="errorIcon"
  13. :showLoading="showLoading"
  14. :showError="showError"
  15. :fade="fade"
  16. :webp="webp"
  17. :duration="duration"
  18. :bgColor="bgColor"
  19. :customStyle="customStyle"
  20. @click="$emit('click')"
  21. @error="$emit('error')"
  22. @load="$emit('load')"
  23. >
  24. <template v-slot:loading>
  25. <slot name="loading"></slot>
  26. </template>
  27. <template v-slot:error>
  28. <slot name="error"></slot>
  29. </template>
  30. </uvImage>
  31. </template>
  32. <script>
  33. /**
  34. * 此组件存在的理由是,在nvue下,u-image被uni-app官方占用了,u-image在nvue中相当于image组件
  35. * 所以在nvue下,取名为u--image,内部其实还是u-iamge.vue,只不过做一层中转
  36. */
  37. import uvImage from '../u-image/u-image.vue';
  38. import props from '../u-image/props.js';
  39. /**
  40. * Image 图片
  41. * @description 此组件为uni-app的image组件的加强版,在继承了原有功能外,还支持淡入动画、加载中、加载失败提示、圆角值和形状等。
  42. * @tutorial https://uviewui.com/components/image.html
  43. * @property {String} src 图片地址
  44. * @property {String} mode 裁剪模式,见官网说明 (默认 'aspectFill' )
  45. * @property {String | Number} width 宽度,单位任意,如果为数值,则为px单位 (默认 '300' )
  46. * @property {String | Number} height 高度,单位任意,如果为数值,则为px单位 (默认 '225' )
  47. * @property {String} shape 图片形状,circle-圆形,square-方形 (默认 'square' )
  48. * @property {String | Number} radius 圆角值,单位任意,如果为数值,则为px单位 (默认 0 )
  49. * @property {Boolean} lazyLoad 是否懒加载,仅微信小程序、App、百度小程序、字节跳动小程序有效 (默认 true )
  50. * @property {Boolean} showMenuByLongpress 是否开启长按图片显示识别小程序码菜单,仅微信小程序有效 (默认 true )
  51. * @property {String} loadingIcon 加载中的图标,或者小图片 (默认 'photo' )
  52. * @property {String} errorIcon 加载失败的图标,或者小图片 (默认 'error-circle' )
  53. * @property {Boolean} showLoading 是否显示加载中的图标或者自定义的slot (默认 true )
  54. * @property {Boolean} showError 是否显示加载错误的图标或者自定义的slot (默认 true )
  55. * @property {Boolean} fade 是否需要淡入效果 (默认 true )
  56. * @property {Boolean} webp 只支持网络资源,只对微信小程序有效 (默认 false )
  57. * @property {String | Number} duration 搭配fade参数的过渡时间,单位ms (默认 500 )
  58. * @property {String} bgColor 背景颜色,用于深色页面加载图片时,为了和背景色融合 (默认 '#f3f4f6' )
  59. * @property {Object} customStyle 定义需要用到的外部样式
  60. * @event {Function} click 点击图片时触发
  61. * @event {Function} error 图片加载失败时触发
  62. * @event {Function} load 图片加载成功时触发
  63. * @example <u--image width="100%" height="300px" :src="src"></u--image>
  64. */
  65. export default {
  66. name: 'u--image',
  67. mixins: [uni.$u.mpMixin, props, uni.$u.mixin],
  68. components: {
  69. uvImage
  70. },
  71. }
  72. </script>