mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 07:16:15 -04:00
feat: component base
This commit is contained in:
parent
02dafd6a2f
commit
6e0c369398
17 changed files with 1482 additions and 1006 deletions
|
@ -1,28 +1,29 @@
|
|||
<script lang="ts">
|
||||
import {Component, Vue} from 'nuxt-property-decorator'
|
||||
import ToolWrapper from '~/components/ToolWrapper.vue';
|
||||
|
||||
interface ToolConfig {
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export {ToolConfig}
|
||||
import ToolWrapper from '~/components/ToolWrapper.vue'
|
||||
import {ToolConfig} from '~/types/ToolConfig'
|
||||
|
||||
@Component({components: {ToolWrapper}})
|
||||
export default class Tool extends Vue {
|
||||
public isTool = true;
|
||||
public config: ToolConfig = {
|
||||
title: 'Tool',
|
||||
description: 'Tool description'
|
||||
}
|
||||
config(): ToolConfig {
|
||||
throw new Error('You need to specify a config() method your custom Tool.')
|
||||
};
|
||||
|
||||
public head() {
|
||||
const {title, description} = this.config
|
||||
const {title, description, keywords} = this.config()
|
||||
|
||||
return {
|
||||
title,
|
||||
description
|
||||
meta: [
|
||||
{
|
||||
name: 'description',
|
||||
content: description
|
||||
},
|
||||
{
|
||||
name: 'keywords',
|
||||
content: keywords
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue