// components/My_SupplyAndDemandItemBox/index.js
Component({
    options: {
        addGlobalClass: true,
        multipleSlots: true
    },
    /**
     * 组件的属性列表
     */
    properties: {
        title: {
            type: String,
            value: "标题"
        },
        time: {
            type: String
        },
        content: {
            type: String
        },
        imageList: {
            type: Array,
            value: []
        },
        stopOnShow: {
            type: Function
        },
        type: {
            type: String
        }
    },
    lifetimes: {
        attached: function () {
            // 在组件实例进入页面节点树时执行

        },
        detached: function () {
            // 在组件实例被从页面节点树移除时执行
        },
    },

    /**
     * 组件的初始数据
     */
    data: {
        urls: [],
    },

    /**
     * 组件的方法列表
     */
    methods: {
        /* 预览图片 */
        previewImage(e) {
            let imageList = this.data.imageList,
                urls = [];
            for (let i = 0; i < imageList.length; i++) {
                urls.push(imageList[i].fobsurl)
            }
            const {
                index
            } = e.currentTarget.dataset
            wx.previewImage({
                urls: urls,
                current: index
            })
            setTimeout(() => {
                this.triggerEvent('stopOnShow');
            }, 100)
        }
    }
})