Files
raven-client/ayanova/src/components/url-control.vue
2022-01-11 22:08:38 +00:00

28 lines
571 B
Vue

<template>
<v-text-field
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>