<template>
  <v-text-field
    dense
    v-bind="$attrs"
    type="url"
    prepend-icon="$ayiExternalLinkAlt"
    v-on="$listeners"
    @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>
