// component/fileItem/fileItem.ts import { TimeUtil } from '../../utils/TimeUtil' import { httpUtil } from "../../utils/restful"; Component({ /** * 组件的属性列表 */ properties: { itemData: null }, /** * 组件的初始数据 */ data: { fileUploadTime: '' }, lifetimes: { attached: function () { // 在组件实例被从页面节点树添加时执行 console.log("fileItem:", this.properties.itemData.uploadTime) this.setData({ fileUploadTime: TimeUtil.dateFormat(parseInt(this.properties.itemData.uploadTime), "yyyy-MM-dd HH:mm"), }) }, detached: function () { // 在组件实例被从页面节点树移除时执行 }, }, /** * 组件的方法列表 */ methods: { clickFileItem: function (event: any) { console.log("event.currentTarget.id:", event.currentTarget.id) //根据ID查询文件库下所有文件 let params = { lessId: event.currentTarget.id, userId: httpUtil.httpData.userId, pageNo: 1, pageSize: 100000, } httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => { console.log("获取所有文件成功:", res) }).catch((res) => { console.log("获取所有文件失败:", res) }) }, clickMore: function (event: any) { console.log("event.currentTarget.id:more----------", event.currentTarget.id) } } })