// components/card/card.ts Component({ /** * 组件的属性列表 */ properties: { cardId: String, name: String, cover: String, lastTime: { type: String, optionalTypes: [String, null], value: '' }, status: Number, isHoster: { type: Boolean, value: false } }, /** * 组件的初始数据 */ data: { }, /** * 组件的方法列表 */ methods: { gotoRoom(event: WechatMiniprogram.TouchEvent) { const { id, status } = event.currentTarget.dataset this.triggerEvent('toRoom', { roomId: id, status: status, role: this.properties.isHoster ? 'leader' : 'customer' }) } } })