<template>
  <v-text-field
    v-bind="$attrs"
    v-on="$listeners"
    type="url"
    prepend-icon="$ayiExternalLinkAlt"
    @click:prepend="openUrl"
  ></v-text-field>
</template>
<script>
export default {
  methods: {
    openUrl() {
      if (
        this.$el &&
        this.$el.attributes &&
        this.$el.attributes.value &&
        this.$el.attributes.value.value
      ) {
        let link = this.$el.attributes.value.value;
        link = link.indexOf("://") === -1 ? "//" + link : link;
        window.open(link, "_blank");
      }
    }
  }
};
</script>
