refactor(client): use composition api

This commit is contained in:
syuilo 2022-01-07 16:48:51 +09:00
parent 298e950e81
commit 40075761fa
3 changed files with 23 additions and 47 deletions

View file

@ -2,9 +2,5 @@
<MkLoading/>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import * as os from '@/os';
export default defineComponent({});
<script lang="ts" setup>
</script>

View file

@ -67,8 +67,8 @@
</MkSpacer>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
<script lang="ts" setup>
import { ref } from 'vue';
import { version, instanceName } from '@/config';
import FormLink from '@/components/form/link.vue';
import FormSection from '@/components/form/section.vue';
@ -79,37 +79,21 @@ import * as os from '@/os';
import number from '@/filters/number';
import * as symbols from '@/symbols';
import { host } from '@/config';
import { i18n } from '@/i18n';
export default defineComponent({
components: {
MkKeyValue,
FormSection,
FormLink,
FormSuspense,
FormSplit,
},
const stats = ref(null);
data() {
return {
const initStats = () => os.api('stats', {
}).then((res) => {
stats.value = res;
});
defineExpose({
[symbols.PAGE_INFO]: {
title: this.$ts.instanceInfo,
title: i18n.locale.instanceInfo,
icon: 'fas fa-info-circle',
bg: 'var(--bg)',
},
host,
version,
instanceName,
stats: null,
initStats: () => os.api('stats', {
}).then((stats) => {
this.stats = stats;
})
}
},
methods: {
number
}
});
</script>

View file

@ -7,19 +7,15 @@
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import * as os from '@/os';
<script lang="ts" setup>
import * as symbols from '@/symbols';
import { i18n } from '@/i18n';
export default defineComponent({
data() {
return {
defineExpose({
[symbols.PAGE_INFO]: {
title: this.$ts.notFound,
icon: 'fas fa-exclamation-triangle'
},
}
title: i18n.locale.notFound,
icon: 'fas fa-exclamation-triangle',
bg: 'var(--bg)',
},
});
</script>