index.js 820 Bytes
// 商品card
Component({
  externalClasses: ['custom-class'],
  /**
   * 组件的属性列表
   */
  properties: {
    src: {
      type: String,
      value: ''
    },
    mode: {
      type: String,
      value: ''
    },
    lazyLoad: {
      type: Boolean,
      value: true
    },
    title: {
      type: [String, Number],
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    imagePath: '',
    showPreviewPoster: false,
    posterPath: ''
  },

  methods: {
    // 预览海报
    previewPoster() {
      const url = this.data.src;
      this.setData({
        posterPath: url,
        showPreviewPoster: true
      })
    },

    // 关闭海报预览
    closePreviewPoster() {
      this.setData({
        posterPath: '',
        showPreviewPoster: false
      })
    }
  }

})