18 lines
449 B
TypeScript
18 lines
449 B
TypeScript
import { Component, Vue } from 'vue-property-decorator';
|
|
import { IResource } from '@/types/resource';
|
|
|
|
@Component
|
|
export default class ResourceMixin extends Vue {
|
|
resourcePath(resource: IResource): string {
|
|
const path = resource.path;
|
|
if (path && path[0] === '/') {
|
|
return path.slice(1);
|
|
}
|
|
return path || '';
|
|
}
|
|
|
|
resourcePathArray(resource: IResource): string[] {
|
|
return this.resourcePath(resource).split('/');
|
|
}
|
|
}
|