Files
sockeye-client/src/components/url-control.vue
2022-12-27 18:55:47 +00:00

29 lines
583 B
Vue

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