<template>
  <a v-if="!to.startsWith('/')" :href="to" :target="target">
    <slot></slot>
  </a>
  <router-link v-else v-bind="vProps">
    <slot></slot>
  </router-link>
</template>
<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
@Component
export default class extends Vue {
  @Prop({
    required: true
  })
  private to!: string;
  @Prop({ default: "_self" }) target!: string;
  get vProps() {
    return { ...this.$props, ...this.$attrs };
  }
}
</script>
