import TyComponent from '../common/component'

TyComponent({
  /**
   * 组件的属性列表
   */
  properties: {
    src: {
      type: String
    },
    fit: {
      type: String,
      value: 'fill'
    },
    alt: {
      type: String
    },
    width: {
      type: [String, Number]
    },
    height: {
      type: [String, Number]
    },
    radius: null,
    round: {
      type: Boolean,
      value: false
    },
    lazyLoad: {
      type: Boolean,
      value: false
    },
    showError: {
      type: Boolean,
      value: true
    },
    showLoading: {
      type: Boolean,
      value: true
    },
    useErrorSlot: {
      type: Boolean,
      value: false
    },
    useLoadingSlot: {
      type: Boolean,
      value: false
    },
    showMenuByLongpress: {
      type: Boolean,
      value: false
    },
    customClass: {
      type: String
    },
    imageClass: {
      type: String
    },
    loadingClass: {
      type: String
    },
    errorClass: {
      type: String
    }

  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleClick({detail}) {
      this.triggerEvent('click', detail)
    },
    handleLoad({detail}) {
      this.triggerEvent('load', detail)
    },
    handleError({detail}) {
      this.triggerEvent('error', detail)
    },
  }
})
