1
0
Fork 0

Use eslint-config-awzzm-vue, refactor some code and improve NavigationBar.vue

This commit is contained in:
Moritz Ruth 2020-08-04 20:39:22 +02:00
parent eb9ad07a86
commit 37e43d4098
No known key found for this signature in database
GPG key ID: AFD57E23E753841B
23 changed files with 2141 additions and 1842 deletions

View file

@ -31,44 +31,32 @@
</style>
<script>
import ExternalIcon from "@/assets/icons/external.svg";
import ExternalIcon from "@/assets/icons/external.svg"
export default {
name: "ExternalLink",
components: { ExternalIcon },
props: {
href: {
type: String,
required: true
},
showProtocol: {
type: Boolean,
default: false
},
showQuery: {
type: Boolean,
default: false
}
href: { type: String, required: true },
showProtocol: { type: Boolean },
showQuery: { type: Boolean }
},
computed: {
label() {
// eslint-disable-next-line import/no-extraneous-dependencies
const url = new (process.server ? require("url").URL : window.URL)(this.href);
let label = "";
const url = new (process.server ? require("url").URL : window.URL)(this.href)
let label = ""
if (this.showProtocol) {
label += url.protocol;
label += "//";
label += url.protocol
label += "//"
}
label += url.host + url.pathname;
label += url.host + url.pathname
if (this.showQuery) {
label += url.search;
}
return label;
if (this.showQuery) label += url.search
return label
}
}
};
}
</script>