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