Improve url visual (#2591)
* Use string interpolation * improve url visual * fix lint
This commit is contained in:
parent
c145c994a9
commit
99fbd60265
1 changed files with 5 additions and 4 deletions
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import { toUnicode as decodePunycode } from 'punycode';
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['url', 'target'],
|
props: ['url', 'target'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -27,11 +28,11 @@ export default Vue.extend({
|
||||||
created() {
|
created() {
|
||||||
const url = new URL(this.url);
|
const url = new URL(this.url);
|
||||||
this.schema = url.protocol;
|
this.schema = url.protocol;
|
||||||
this.hostname = url.hostname;
|
this.hostname = decodePunycode(url.hostname);
|
||||||
this.port = url.port;
|
this.port = url.port;
|
||||||
this.pathname = url.pathname;
|
this.pathname = decodeURIComponent(url.pathname);
|
||||||
this.query = url.search;
|
this.query = decodeURIComponent(url.search);
|
||||||
this.hash = url.hash;
|
this.hash = decodeURIComponent(url.hash);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue