link.js 478 Bytes
Newer Older
李嘉林 committed
1
export const link = Behavior({
程默 committed
2 3 4 5 6
  properties: {
    url: String,
    linkType: {
      type: String,
      value: 'navigateTo',
李嘉林 committed
7
    },
程默 committed
8 9 10 11 12 13 14 15 16 17 18 19
  },
  methods: {
    jumpLink(urlKey = 'url') {
      const url = this.data[urlKey];
      if (url) {
        if (
          this.data.linkType === 'navigateTo' &&
          getCurrentPages().length > 9
        ) {
          wx.redirectTo({ url });
        } else {
          wx[this.data.linkType]({ url });
李嘉林 committed
20
        }
程默 committed
21 22 23
      }
    },
  },
李嘉林 committed
24
});