layout-link.vue 621 Bytes
<template>
  <a href="javascript:;" class="layout-link" @click="jumpTo">
    <slot></slot>
  </a>
</template>

<script>
export default {
  name: 'LayoutLink',
  props: {
    href: String
  },
  methods: {
    jumpTo() {
      if (!this.href) {
        return;
      }

      // TODO url解析

      if (this.$yoho.isAliApp && window.WindVane) {
        window.WindVane.call('Base', 'openWindow', params, data => {
          console.log('open new window success: ' + this.href);
        }, e => {
          window.open(this.href);
        });
      } else {
        window.open(this.href);
      }
    }
  }
};
</script>