mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-24 00:03:07 +02:00
Refactor
This commit is contained in:
parent
ba8ffda32a
commit
517ea6a119
1 changed files with 16 additions and 7 deletions
|
@ -22,7 +22,16 @@ import { toUnicode as decodePunycode } from 'punycode';
|
||||||
import { url as local } from '../config';
|
import { url as local } from '../config';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['url', 'rel'],
|
props: {
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
rel: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
const isSelf = this.url.startsWith(local);
|
const isSelf = this.url.startsWith(local);
|
||||||
const hasRoute = isSelf && (
|
const hasRoute = isSelf && (
|
||||||
|
@ -32,12 +41,12 @@ export default Vue.extend({
|
||||||
this.url.substr(local.length).startsWith('/tags/'));
|
this.url.substr(local.length).startsWith('/tags/'));
|
||||||
return {
|
return {
|
||||||
local,
|
local,
|
||||||
schema: null,
|
schema: null as string | null,
|
||||||
hostname: null,
|
hostname: null as string | null,
|
||||||
port: null,
|
port: null as string | null,
|
||||||
pathname: null,
|
pathname: null as string | null,
|
||||||
query: null,
|
query: null as string | null,
|
||||||
hash: null,
|
hash: null as string | null,
|
||||||
self: isSelf,
|
self: isSelf,
|
||||||
hasRoute: hasRoute,
|
hasRoute: hasRoute,
|
||||||
attr: hasRoute ? 'to' : 'href',
|
attr: hasRoute ? 'to' : 'href',
|
||||||
|
|
Loading…
Reference in a new issue