diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-31 21:41:08 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-31 21:41:08 +0900 |
| commit | 3178bb20c72380c4379e7b72afa7e468d24e3e97 (patch) | |
| tree | 5c6850f93da08e3e28d0993368e1f69781278257 /src/client/app/common/views/components/url.vue | |
| parent | Merge pull request #1341 from akihikodaki/github (diff) | |
| download | misskey-3178bb20c72380c4379e7b72afa7e468d24e3e97.tar.gz misskey-3178bb20c72380c4379e7b72afa7e468d24e3e97.tar.bz2 misskey-3178bb20c72380c4379e7b72afa7e468d24e3e97.zip | |
Use Vue rendering function
and some refactors
Diffstat (limited to 'src/client/app/common/views/components/url.vue')
| -rw-r--r-- | src/client/app/common/views/components/url.vue | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/client/app/common/views/components/url.vue b/src/client/app/common/views/components/url.vue new file mode 100644 index 0000000000..e6ffe4466d --- /dev/null +++ b/src/client/app/common/views/components/url.vue @@ -0,0 +1,57 @@ +<template> +<a class="mk-url" :href="url" :target="target"> + <span class="schema">{{ schema }}//</span> + <span class="hostname">{{ hostname }}</span> + <span class="port" v-if="port != ''">:{{ port }}</span> + <span class="pathname" v-if="pathname != ''">{{ pathname }}</span> + <span class="query">{{ query }}</span> + <span class="hash">{{ hash }}</span> + %fa:external-link-square-alt% +</a> +</template> + +<script lang="ts"> +import Vue from 'vue'; +export default Vue.extend({ + props: ['url', 'target'], + data() { + return { + schema: null, + hostname: null, + port: null, + pathname: null, + query: null, + hash: null + }; + }, + created() { + const url = new URL(this.url); + this.schema = url.protocol; + this.hostname = url.hostname; + this.port = url.port; + this.pathname = url.pathname; + this.query = url.search; + this.hash = url.hash; + } +}); +</script> + +<style lang="stylus" scoped> +.mk-url + word-break break-all + > [data-fa] + padding-left 2px + font-size .9em + font-weight 400 + font-style normal + > .schema + opacity 0.5 + > .hostname + font-weight bold + > .pathname + opacity 0.8 + > .query + opacity 0.5 + > .hash + font-style italic +</style> |