// module/article/components/science-card/science-card.ts
Component({
  properties: {
    item: { type: Object, value: {} },
    index: { type: Number, value: 0 },
    replace: { type: Boolean, value: false },
  },
  data: {},
  methods: {
    toInfoPage(event: WechatMiniprogram.TouchEvent) {
      const id = event.currentTarget.id;
      if (this.data.replace) {
        wx.redirectTo({ url: `/module/article/pages/science-info/science-info?id=${id}` });
      } else {
        wx.navigateTo({ url: `/module/article/pages/science-info/science-info?id=${id}` })
          .then(res => { res.eventChannel.emit('load', this.data.item) })
      }
    }
  }
})