Improve url visual (#2591)

* Use string interpolation

* improve url visual

* fix lint
This commit is contained in:
tamaina 2018-09-02 20:19:59 +09:00 committed by syuilo
parent c145c994a9
commit 99fbd60265

View file

@ -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>