// components/user-card/user-card.js // 用户卡片组件 Component({ properties: { user: { type: Object, value: {} }, showFollow: { type: Boolean, value: true } }, data: { isFollowing: false }, lifetimes: { attached() { if (this.data.user) { this.setData({ isFollowing: this.data.user.isFollowing || false }) } } }, methods: { onTap() { const user = this.data.user if (user && user.id) { wx.navigateTo({ url: `/pages/user-profile/user-profile?userId=${user.id}` }) } }, onFollow(e) { e.stopPropagation() const user = this.data.user if (!user || !user.id) return const isFollowing = !this.data.isFollowing this.setData({ isFollowing }) this.triggerEvent('follow', { userId: user.id, isFollowing }) } } }) /** * @联系作者:16768118056 * @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。 * @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。 */